Jan 06 2022 12:42 PM
Hi everyone!
I am very very new to Macros and am trying to do the following:
Add a macro (that I can then add to a button) that when I click it, it automatically finds todays date in column A, and then scrolls to place that cell directly at the top of the list, being that I have frozen the panes at the top. I have conditionally formatted so that the row with todays date in turns pink.
So you can see the picture below showing various dates in column A, and then todays date in pink further down. I want it so I can click a macro and it automatically does what you can see in then next picture, scroll to place 'today' just under row 7 (where panes are frozen).
Can anyone help?
Thank you in advance! :)
Andrew
Jan 06 2022 12:53 PM
SolutionTry this macro:
Sub GoToToday()
Dim rng As Range
Set rng = Range("A:A").Find(What:=Date, LookIn:=xlFormulas)
If rng Is Nothing Then
Beep
Else
Application.Goto rng, True
End If
End Sub
Jan 07 2022 02:11 AM
@Hans Vogelaar absolutely amazing, works perfectly! Thank you so much :). Any recommendations on where I can start for learning Macros?
Jan 06 2022 12:53 PM
SolutionTry this macro:
Sub GoToToday()
Dim rng As Range
Set rng = Range("A:A").Find(What:=Date, LookIn:=xlFormulas)
If rng Is Nothing Then
Beep
Else
Application.Goto rng, True
End If
End Sub