Forum Discussion
I need a little help
I've played around with the code and I still can not get it to execute the command.
Here is the code in question.
If [C2] = "Initial Legal Filing" And [C34] = "Two Defendants-Served at Different Addresses" Then
Sheets("Sheriff's Svc-Addtl Address").Visible = True
Else
Sheets("Sheriff's Svc-Addtl Address").Visible = False
End If
Its probably something simple and I just don't see it. No matter what is selected in C34 the sheet is always visible. :/
2 Replies
- arnel_gpSteel Contributor
add code to the Workbook_SheetChange event:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Const YOUR_SHEET As String = "SHEET1" If UCase(Sh.Name) = YOUR_SHEET Then With ActiveSheet If .Range("$C$2") & "" = "Initial Legal Filing" And .Range("$C$34") & "" = "Two Defendants-Served at Different Addresses" Then Sheets("Sheriff's Svc-Addtl Address").Visible = -1 Else Sheets("Sheriff's Svc-Addtl Address").Visible = 0 End If End With End If End Sub
- m_tarlerBronze Contributor
I would make sure the values are correct. I would use debug and step through and the immediate pane (ctrl-g) to test each component. for example
print [C34]="Two Defendants-Served at Different Addresses"
and see if it returns TRUE
and also in the immediate pane you can
Sheets('Sheriff's Svc-Addtl Address").Visible = False
and see if that works