Hello,
I am a real novice to VBA but am trying to learn. I would like to include a macro in my spreadsheets that automatically unhide the rows below, one by one, if there is a value in the row above. eg if a date is entered in B11, row 12 is revealed when the user goes across to cell C11. The best I got so far is that all the rows are unhidden (the range is 11 to 59) but not one to one. This is what I got so far:
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("Expense Form").Range("A10") = 0 Then
Application.ScreenUpdating = False
Else
Dim rng As Range
For Each rng In Range("A11:A60")
Select Case rng.Value
Case Is <> 0
Cells(rng.Row, 1).EntireRow.Hidden = False
Case Else
Cells(rng.Row, 1).EntireRow.Hidden = True
End Select
Next rng
Application.ScreenUpdating = True
End If
End Sub
But that isn't working really.
Thank you for your help.
Mieke
I am a real novice to VBA but am trying to learn. I would like to include a macro in my spreadsheets that automatically unhide the rows below, one by one, if there is a value in the row above. eg if a date is entered in B11, row 12 is revealed when the user goes across to cell C11. The best I got so far is that all the rows are unhidden (the range is 11 to 59) but not one to one. This is what I got so far:
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("Expense Form").Range("A10") = 0 Then
Application.ScreenUpdating = False
Else
Dim rng As Range
For Each rng In Range("A11:A60")
Select Case rng.Value
Case Is <> 0
Cells(rng.Row, 1).EntireRow.Hidden = False
Case Else
Cells(rng.Row, 1).EntireRow.Hidden = True
End Select
Next rng
Application.ScreenUpdating = True
End If
End Sub
But that isn't working really.
Thank you for your help.
Mieke