Hello All
I have a workbook calendar where I am using the below macro entered in the February sheet to hide the 29th Feb date column (AD) based on the value in cell A5. The A5 cell value is controlled by a formula (Cell A5 value of 1 = hide the column & Cell A5 value of "Leap Year" = show the column).
Everything works as it should however the macro will not run until I select a cell on the February worksheet. Is there a way to make the macro run as soon as the A5 value changes?
Thanks in advance.
Private Sub Worksheet_selectionchange(ByVal Target As Range)
If Sheets("February").Range("A5").Value = 1 Then
Sheets("February").Columns("AD").EntireColumn.Hidden = True
Else
Sheets("February").Columns("AD").EntireColumn.Hidden = False
End If
End Sub
I have a workbook calendar where I am using the below macro entered in the February sheet to hide the 29th Feb date column (AD) based on the value in cell A5. The A5 cell value is controlled by a formula (Cell A5 value of 1 = hide the column & Cell A5 value of "Leap Year" = show the column).
Everything works as it should however the macro will not run until I select a cell on the February worksheet. Is there a way to make the macro run as soon as the A5 value changes?
Thanks in advance.
Private Sub Worksheet_selectionchange(ByVal Target As Range)
If Sheets("February").Range("A5").Value = 1 Then
Sheets("February").Columns("AD").EntireColumn.Hidden = True
Else
Sheets("February").Columns("AD").EntireColumn.Hidden = False
End If
End Sub