I'm trying to create a macro that will take the user to the current day in a large excel calendar when they click a button. I'm currently attempting to do this using the find function by having it look up the current date in a cell in the worksheet, which date is updated using the TODAY() formula. The current date (i.e., the TODAY() formula) is in cell F4, and the calendar is in cells C13:J1000.
Anyway, I'm very new to VBA, but below is my attempt. If I enter in a day that I want, for example "Wednesday, August 03, 2011" I can get it to work, but I would like it to automatically update so other users can simply click the button to go to the current day. However, I have been unable to get that to work so far - the "Not Found" message box is all that gets returned.
Any suggestions or ideas would be greatly appreciated. Thanks!
Sub Findinrange1()
Range("C13:J1000").Select
mystring = ActiveSheet.Cells(4, 6).Value
Set RangeObj = Selection.Find(What:=mystring, After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If RangeObj Is Nothing Then MsgBox "Not Found" Else RangeObj.Select
End Sub
Anyway, I'm very new to VBA, but below is my attempt. If I enter in a day that I want, for example "Wednesday, August 03, 2011" I can get it to work, but I would like it to automatically update so other users can simply click the button to go to the current day. However, I have been unable to get that to work so far - the "Not Found" message box is all that gets returned.
Any suggestions or ideas would be greatly appreciated. Thanks!
Sub Findinrange1()
Range("C13:J1000").Select
mystring = ActiveSheet.Cells(4, 6).Value
Set RangeObj = Selection.Find(What:=mystring, After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If RangeObj Is Nothing Then MsgBox "Not Found" Else RangeObj.Select
End Sub