OK, I have a macro assigned to a button to hide a tab depending on value of a drop down list.
Sub Hide_Tabs()
' Hide unused Tabs
If Sheet4.Range("G2") = Sheet13.Range("B154") Then
Sheet5.Visible = False
Else
Sheet16.Visible = False
End If
End Sub
Works fine on all my tests, and I also have a macro assigned to a sheet (not a module ) to delete value on a cell bellow if cell B8 value change, I use it for conditional drop down. (Eg. Cel B8 has a list of type of bricks and cel B9 has a list of colours available depending on type of brick)
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'Call dropdowns on column 2 (B) Row 8
If Target.Column = 2 And Target.Row = 8 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
'clear content on cell 1 bellow of dropdown
Target.Offset(1, 0).ClearContents
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub
Anyway.. works fine too.. Now I'm trying to get first macro result, the way the second macro works by placing a code on Sheet 4, 2 different tabs should be hidded depending on value of cel G2, I got so far:
Private Sub Hide_Tiling(ByVal Target As Range)
On Error Resume Next
'if dropdown on Shee4 G2 value = Sheet13 B154, hide Sheet5.
'if not, hide Sheet6
If Target.Column = 7 And Target.Row = 2 Then
If Sheet4.Range("G2") = Sheet13.Range("B154") Then
Application.EnableEvents = False
Sheet5.Visible = False
Else
Sheet16.Visible = False
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub
It does not return error neither does anything :) What I am missing?
Does it matter if cell G2 and H2 are merged? I also tried to unmerge them therefore point only to cell G2 ans still nothing...
Thanks