Forum Discussion

MCNEILS5's avatar
MCNEILS5
Copper Contributor
Oct 08, 2024

Button To Navigate In Excel

I've tried to find something that might work for this but have been unable to find anything.

 

My work we use excel to manage our schedule and everyone's appointments and whatnot. We have a row with the days of the week sequentially and everyone's appointments for that day are within a column. ie JA is the column for 21 Sep, JA3 is where the date is listed, and JA8 thru JA78 is where an appointment would be added for a specific person.

 

I would like to know if there's a way to add a button in our header rows that will select either the cell that has the current day's date, or better yet select the whole column that contains the date.

 

Thanks for any help!

  • MCNEILS5 

    I didn't read your initial question carefully enough.

    Assuming that the dates are in row 1, assign the following macro to a Form Control command button:

    Sub Button1_Click()
        Application.Goto Rows(1).Find(What:=Date, LookIn:=xlFormulas), True
        ActiveCell.EntireColumn.Select
    End Sub
  • MCNEILS5 

    Let's say that you have dates in E1:MZ1.

    Select columns E:MZ.

    The active cell in the selection should be in the first column, i.e. in column E.

    On the Home tab of the ribbon, click Conditional Formatting > New Rule...
    Select 'Use a formula to determine which cells to format'.
    Enter the formula

    =E$1=TODAY()

    (Remember, E1 is the cell in row 1 in the first column of the selection)

    Click Format...
    Activate the Fill tab.
    Select a fill color.
    Click OK, then click OK again.

    • MCNEILS5's avatar
      MCNEILS5
      Copper Contributor
      HansVogelaar

      Thank you for this, I realize I asked the question unclearly and have updated it.
      I'm not looking to highlight the row as in formatting. I'd like a button in the area of A1 that is fixed on our sheet where you click it to navigate to that column. So say I'm scrolled over into next year, a button that would take me back to the column for today within the sheet
      • MCNEILS5 

        I didn't read your initial question carefully enough.

        Assuming that the dates are in row 1, assign the following macro to a Form Control command button:

        Sub Button1_Click()
            Application.Goto Rows(1).Find(What:=Date, LookIn:=xlFormulas), True
            ActiveCell.EntireColumn.Select
        End Sub

Resources