Forum Discussion
Alecs
Nov 06, 2022Brass Contributor
simple macro: jump to selected column
Hello guys,
need your help creating a macro button:
in row 1, I have this formula:
=IF(E2=TODAY();"today";"not")
in row 2, I have typed each day within a month.
I need a button that once clicked will jump to the corresponding column where cell from row 1 contains: today. This means that it will scroll to that column and select that cell.
please note that "today" is the result of the IF function shown above. It's not an inserted text.
I attach the excel file
Many thanks in advance!
Alecs
Sub today() Dim i As Long i = Application.WorksheetFunction.Match("today", Rows(1), 0) Cells(2, i).Select End SubYou can try this code.
2 Replies
- OliverScheurichGold Contributor
Sub today() Dim i As Long i = Application.WorksheetFunction.Match("today", Rows(1), 0) Cells(2, i).Select End SubYou can try this code.
- AlecsBrass ContributorIt works perfect! thanks!