Results 1 to 5 of 5

Thread: StripSlashes from Date Function?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    2

    StripSlashes from Date Function?

    Hi guys, Just trying to setup an application that will log in data I store in it per day. I have a main data sheet, a front page with functions / macros / forms etc for easy data entry and I am having a bit of trouble seperating the days in my data sheet.

    What I have decided to do which seems very easy once I can get past this is to create arrays / tables / groupings for each day.... The code that I have created so far is :

    Rows("7:7").Select
    Selection.Insert Shift:=xlDown
    Selection.Insert Shift:=xlDown
    Selection.Insert Shift:=xlDown
    ActiveWorkbook.Names.Add Name:=Date, RefersToR1C1:="=Data!R6:R8"

    What this does is give the day a bit of seperation from other days and then creates a table/array from the days. The data entry form adds rows at 7 so this array grows with each piece of data that is added into it.... The only problem with this is that the Name wont accept "/" so when inserting Date it comes up with "This is not allowed" error. Is there a way I can make Date into just alphanumeric without these "/" ? Or would I have to say insert Date into A1 and then use a function to strip slashes in A2 and then just use the value in A2 ?

    --------------------------------------------------------------------------------

    I will upload what I have done...

    What I am planning to do is when a table is opened, I plan to use something like DateTime.Now instead of having to input it manually but that is later on.

    For now I would like the "Start New Day" Form, when clicking on the Command Button "Yes" to create the array and name it by the date of the day. That way when I finish the day late I can work out totals from the array.

    The work I have done so far can be found at this link:

    http://www.dowr.com/PokerLog.xls

  2. #2
    Hyperactive Member
    Join Date
    May 2001
    Location
    TZI Transition Date
    Posts
    272

    Re: StripSlashes from Date Function?

    ...you can do anything with dates...BUT some of your custom formatting may not be recognized as a date by (Dim as Date) and excel...your best 'bet' (haha) is to just check out date and format functions in the excel VBE help menu...tons of them...
    VB Code:
    1. MsgBox Replace(Now, "/", "")
    2.     MsgBox Replace(Now, "/", "<><>")
    3.     MsgBox DatePart("d", Now)
    4.     MsgBox DatePart("m", Now)
    5.     MsgBox DatePart("yyyy", Now)
    6.     MsgBox Format(Now, "hh:mm  dd'mmm'yy")
    7.     MsgBox Format(Now, "hh:mm  dd-mmm-yy")
    8.     MsgBox Format(Now, "dddd")

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    2

    Re: StripSlashes from Date Function?

    Hi there have you got MSN or some email so I can speak with you further? I am really new to this (apart from an A level project) but that was just simple ----> mediocre VBa usage.

    Just wondering if you could be more specific and fit the code into what I have already done?

  4. #4
    Hyperactive Member
    Join Date
    May 2001
    Location
    TZI Transition Date
    Posts
    272

    Re: StripSlashes from Date Function?

    glad to help you with taking a date and changing into a different format, extract quanties, create , time zone diff...stuff like that ...

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: StripSlashes from Date Function?

    Perhaps a sily question but why are you using Excel for this instead of Access (for learning) or someother db for larger implementations?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width