SOLVED

Macro for Todays date

Occasional Contributor

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).

 

Andrew_Hinson_1-1641501335556.png

Andrew_Hinson_2-1641501373032.png

 

 

Can anyone help?

 

Thank you in advance!

Andrew

 

4 Replies
best response confirmed by Andrew_Hinson (Occasional Contributor)
Solution

@Andrew_Hinson 

Try 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

@Hans Vogelaar absolutely amazing, works perfectly! Thank you so much :). Any recommendations on where I can start for learning Macros?

That's great, thank you very much.