Solved: have a macro recognize different date formats

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

mrl

Thread Starter
Joined
Aug 12, 2007
Messages
348
Hi

First Happy New Year :D

Is there a way to modify the following to recognize a date that has the format: 2/27/12
(m/dd/yy). This one only recognizes the standard format: *m/dd/yyyy
I just want to know in case I need to write a code that has to fine a date with different formats.

HTML:
Sub finddate()   
    On Error GoTo Errorline
Cells.find(Date).Select
    ActiveCell.Offset(0, 1).Range("A1").Select
        Selection.End(xlDown).Select
        ActiveCell.Offset(1, 0).Range("A1").Select
ActiveWindow.ScrollRow = ActiveCell.Row - 15
Exit Sub
Errorline: Call newopen
End Sub
What the code does is look for today’s date in A:A, move over one cell and down to the first empty cell where I can add data.

If it doesn’t find today’s date, it goes to yesterday’s date and again moves over one cell and down to the first empty cell. Then a messages box pops up and asks if I want today’s date entered (newopen). If no, then it ends. If yes, it brings up another sub that puts todays where I need it (with.. copy-pastespecial-value) moves to the right one cell and I can add data.
A:A will always have yesterday’s date and sometimes today’s date.

Mike
 

mrl

Thread Starter
Joined
Aug 12, 2007
Messages
348
Hi Garf13LD,

Happy New Year

I don't know what happened :confused:
I've tried the code with different date formats, but it didn't work.
After I saw your answer, i tried it again with m/d/yy and it worked perfectly.
You must have done something to my cpu when I came onto this site :D

Thanks again

mike
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top