I am trying to find a way to find a way to show or hide rows 55:57 based on the value in Cell J52. Ideally, I would want this to happen in Real-Time Using VBA.
The value in J52 goes from 0 - 3.
I tried this code but it doesn't work as it throws an error stating "Sub or Function not defined":
Private Sub Worksheet_SelectionChange(ByVal Target As Range) StartRow = 55 EndRow = 57 Tar = C52 For i = Tar To Tar If Cell(i).Value = "Individuals" Then Cells(StartRow, EndRow).EntireRow.Hidden = True Else Cells(StartRow, EndRow).EntireRow.Hidden = False End If Next i End Sub Any help would be appreciated. Thanks.

Cell(i).Valueinstead ofCells(i).Value. You're code won't work though asTar = C52will create Tar as a variant and C52 as a variant - I guess it's a cell range, but to VBA C52 is just an undefined variable (whichOption Explicitwould highlight). So Tar and C52 will equal 0.Worksheet_SelectionChangewill fire when you move from one cell to another (you change the selected cell), rather than when you change cell C52 value.