mgchurch77
New Member
- Joined
- Aug 15, 2011
- Messages
- 33
I have a macro for one worksheet that is set to run based on a specific cell input from the user. The target cell is on a separate sheet from that of the macro. When I run the macro on the target sheet it works, however when I try to run it using a sheet reference it fails.
I am guessing that i have to somehow define the sheet name before I can reference it in code. Here it is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheets("Report Data").Range("H39").Value = 0 Then
Columns("C").EntireColumn.Hidden = True
Else
Columns("C").EntireColumn.Hidden = False
End If
End Sub
I am guessing that i have to somehow define the sheet name before I can reference it in code. Here it is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheets("Report Data").Range("H39").Value = 0 Then
Columns("C").EntireColumn.Hidden = True
Else
Columns("C").EntireColumn.Hidden = False
End If
End Sub