Forum Discussion

Andrew_Hinson's avatar
Andrew_Hinson
Brass Contributor
Jan 06, 2022
Solved

Macro for Todays date

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

 

  • 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

4 Replies

Resources