Hi guys,
My code to show/hide columns on multiple tabs does seem to work. I know it's very basic, but I just learned VBA codes from googling it and I can't seem to crack this one.
What I want to do is hide columns F:J on sheets 1-31 (same sheet names too) if OptionButton1 is clicked and show columns F:J if OptionButton2 is clicked.
This was my very mediocre attempt at testing it on Sheet1. Surprise, surprise. Not working.
Any help is greatly appreciated. Thanks!
My code to show/hide columns on multiple tabs does seem to work. I know it's very basic, but I just learned VBA codes from googling it and I can't seem to crack this one.
What I want to do is hide columns F:J on sheets 1-31 (same sheet names too) if OptionButton1 is clicked and show columns F:J if OptionButton2 is clicked.
This was my very mediocre attempt at testing it on Sheet1. Surprise, surprise. Not working.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If OptionButton1.Value = True Then
Sheet1.Columns("F:G").Hidden = True
Else
Sheet1.Columns("F:G").Hidden = False
End If
End Sub
Any help is greatly appreciated. Thanks!