Hi -
I am trying to assign a form control to run a macro which hides/unhides worksheets that contain specific characters in the worksheet name. I have the following code which allows me to hide/unhide the worksheets but I can't figure out how run it when I click the form control. Thoughts?
Sub HideBilling()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "unbill*" And ws.Visible = False Then
ws.Visible = xlSheetVisible
Else
If ws.Name Like "unbill*" And ws.Visible = True Then
ws.Visible = xlSheetHidden
End If
End If
Next ws
End Sub
I am trying to assign a form control to run a macro which hides/unhides worksheets that contain specific characters in the worksheet name. I have the following code which allows me to hide/unhide the worksheets but I can't figure out how run it when I click the form control. Thoughts?
Sub HideBilling()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "unbill*" And ws.Visible = False Then
ws.Visible = xlSheetVisible
Else
If ws.Name Like "unbill*" And ws.Visible = True Then
ws.Visible = xlSheetHidden
End If
End If
Next ws
End Sub