Ancient Wolf
Board Regular
- Joined
- Mar 17, 2009
- Messages
- 89
Hello. Once again, I seem to be snagged.
I was wondering how to turn this VBA Code:
If Target.Address(False, False) = "B3" Then
ActiveSheet.Unprotect
Rows("25:32").Hidden = Target.Value <> "strawberries"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
So that it will look at strawberries or cherries and then hide and unhide the rows specified in the coding. Any ideas? I tried using an Else statement, but that ended in error. Placing the code like this:
If Target.Address(False, False) = "B3" Then
ActiveSheet.Unprotect
Rows("25:32").Hidden = Target.Value <> "strawberries"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
If Target.Address(False, False) = "B3" Then
ActiveSheet.Unprotect
Rows("25:32").Hidden = Target.Value <> "cherries"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
just causes the code to conflict with itself.
Thank you for the help.
I was wondering how to turn this VBA Code:
If Target.Address(False, False) = "B3" Then
ActiveSheet.Unprotect
Rows("25:32").Hidden = Target.Value <> "strawberries"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
So that it will look at strawberries or cherries and then hide and unhide the rows specified in the coding. Any ideas? I tried using an Else statement, but that ended in error. Placing the code like this:
If Target.Address(False, False) = "B3" Then
ActiveSheet.Unprotect
Rows("25:32").Hidden = Target.Value <> "strawberries"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
If Target.Address(False, False) = "B3" Then
ActiveSheet.Unprotect
Rows("25:32").Hidden = Target.Value <> "cherries"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
just causes the code to conflict with itself.
Thank you for the help.