if statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like help writing some code that would run the code below if the
value of cell a5 is the word "Fixed".

Rows("5:13").Select
Selection.EntireRow.Hidden = True
 
Private Sub Worksheet_Change(ByVal Target As Range)
' Target = the cell/range just changed.

If Target.Address = "$A$5" Then
Select Case UCase(Target)
Case "FIXED"
ActiveSheet.Rows("6:10").EntireRow.Hidden = True
Case "BROKEN"
ActiveSheet.Rows("11:15").EntireRow.Hidden = True
Case "REPAIR"
ActiveSheet.Rows("16:20").EntireRow.Hidden = True
Case "RESTORE"
ActiveSheet.UsedRange.Rows.EntireRow.Hidden = False
Case Else
'Do nothing
End Select
End If
End Sub

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top