Find Today() in my worksheet

jhedges

Board Regular
Joined
May 27, 2009
Messages
208
I have a worksheet with a spinner, which changes the year...The sheet is setup to look like a calendar (4 weeks) with Monday thru Saturday visible (work week) Sunday column is hidden with all twelve months on the same worksheet. The different months then change the date of each day based upon the year selected with a formula.

I'm trying to create a command button that will take the user to the cell with the current date (today()) by scrolling the worksheet. I have the following code, which isn't working currently. My dates are formatted as "mmm-dd" with the command button calling the sub listed below; however, the code is not working currently. Could anyone help me? The error is run-time error 91 Object Variable or With Block Variable not set on the Cells.Find line...

Code:
Sub FindToday()


Dim sheetdate As String
sheetdate = Format(Date, "mmm-dd")


Cells.Find(What:=sheetdate, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
       xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
       , SearchFormat:=False).Activate
End Sub
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I have been able to determine the code works if the date is not a Sunday aka hidden columns in my spreadsheet. Is there away to skip by the hidden Sunday columns B,C, D?
 
Upvote 0

Forum statistics

Threads
1,215,706
Messages
6,126,336
Members
449,310
Latest member
zztt388

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top