TGwilding
09-05-2005, 08:08 PM
I am almost finished with this code but I am ahving a slight problem:
The code is below
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
If Worksheets("Sheet1").Range("B2").Value = MyState Then
GoTo Xit
Else:
Dim cell As Range
For Each cell In Range("B9:B38")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Else: cell.EntireRow.Hidden = False
Next cell
End If
Xit:
MyState = Worksheets("Sheet1").Range("B2").Value
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
The Gap between between If cell.Value and Next Cell is where I am having problems. I would like rows where if cell.Value is not equal to "", then unhide.
Any help would be appreciated.
thanks
The code is below
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
If Worksheets("Sheet1").Range("B2").Value = MyState Then
GoTo Xit
Else:
Dim cell As Range
For Each cell In Range("B9:B38")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Else: cell.EntireRow.Hidden = False
Next cell
End If
Xit:
MyState = Worksheets("Sheet1").Range("B2").Value
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
The Gap between between If cell.Value and Next Cell is where I am having problems. I would like rows where if cell.Value is not equal to "", then unhide.
Any help would be appreciated.
thanks