Hi,
I'm trying to automate a micro to collapse/expand certain cells in a spreadsheet as data is put in (i.e. if Cell A>0, then Cells B-F will expand, if Cell A<0, then Cells B-F will collapse). Currently, the code WILL do that but only AFTER clicking the A column. Below is the code I use, any help would be greatly appreciated
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("$A12:$A100")) Is Nothing Then
If Range("C27").Value = 0 Then
Rows("28:30").EntireRow.Hidden = True
Else
Rows("28:30").EntireRow.Hidden = False
End If
If Range("C35") = 0 Then
Rows("36:38").EntireRow.Hidden = True
Else
Rows("36:38").EntireRow.Hidden = False
End If
End If
End Sub
I'm trying to automate a micro to collapse/expand certain cells in a spreadsheet as data is put in (i.e. if Cell A>0, then Cells B-F will expand, if Cell A<0, then Cells B-F will collapse). Currently, the code WILL do that but only AFTER clicking the A column. Below is the code I use, any help would be greatly appreciated
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("$A12:$A100")) Is Nothing Then
If Range("C27").Value = 0 Then
Rows("28:30").EntireRow.Hidden = True
Else
Rows("28:30").EntireRow.Hidden = False
End If
If Range("C35") = 0 Then
Rows("36:38").EntireRow.Hidden = True
Else
Rows("36:38").EntireRow.Hidden = False
End If
End If
End Sub