Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro - jump to today on work sheet

Status
Not open for further replies.

pariah07

Technical User
Mar 25, 2007
3
US
Help!! im trying find a simple macro or vba code that when ran it will select todays date on the excel worksheet.
 
Well using Macro recorder i was able to Make it happen. Heres what it looks like. (ps i have know idea how or why it works)

Sub Today_Find()
'
' Today_Find Macro
'
' Keyboard Shortcut: Ctrl+t
' Were "Range("Date")" =today()

Range("Date").Select
Selection.Copy
Cells.Find(what:=Date, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
End Sub
Edit/Delete Message
 
Actually above is wrong

Code:
Sub FindDate() 
    Dim c As Range 
     
    Set c = ActiveSheet.Cells.Find(what:=Date, LookIn:=xlValues) 
    If Not c Is Nothing Then c.Select 
     
End Sub

this code works, but the formate of the date must be xx/xx/xx
 

Then, Format te Date;
Code:
Sub FindDate() 
    Dim c As Range 
     
    Set c = ActiveSheet.Cells.Find(what:=[red]Format([/red]Date[red], "xx/xx/xx")[/red], LookIn:=xlValues) 
    If Not c Is Nothing Then c.Select 
     
End Sub

Have fun.

---- Andy
 




"this code works, but the formate of the date must be xx/xx/xx "

The code WORKS! Of course it does!

Why are your concerned about the FORMAT? FORMAT is for DISPLAY.

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top