Option Explicit
Sub CheckSheeet()
If ThisWorkbook.Worksheets(1).Shapes("Check Box 1").OLEFormat.Object.Value = 1 Then
Sheets("Sheet3").Visible = False
Else
Sheets("Sheet3").Visible = True
End If
End Sub
..
Untested because I don't have a MAC :
Code:Option Explicit Sub CheckSheeet() If ThisWorkbook.Worksheets(1).Shapes("Check Box 1").OLEFormat.Object.Value = 1 Then Sheets("Sheet3").Visible = False Else Sheets("Sheet3").Visible = True End If End Sub
Paste in a Routine Module. Assign CheckBox1 to the above macro.
..
Untested because I don't have a MAC :
Code:Option Explicit Sub CheckSheeet() If ThisWorkbook.Worksheets(1).Shapes("Check Box 1").OLEFormat.Object.Value = 1 Then Sheets("Sheet3").Visible = False Else Sheets("Sheet3").Visible = True End If End Sub
Paste in a Routine Module. Assign CheckBox1 to the above macro.
Sub ToggleHideUnhideDataSheets()
Application.ScreenUpdating = False
Dim wb As Workbook
Dim ShtNames() As Variant
Dim i As Integer
Set wb = ActiveWorkbook
ShtNames = Array("Sheet3", "Sheet5", "Sheet9") '<<--- edit sheet names here. You can add or delete sheet names as well but have at least two for the array.
For i = 0 To UBound(ShtNames)
wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible
Next i
Application.ScreenUpdating = True
End Sub
.
This is one way ...
Well ... if you are wanting one checkbox to hide/unhide several sheets at once you can use this macro :
Code:Sub ToggleHideUnhideDataSheets() Application.ScreenUpdating = False Dim wb As Workbook Dim ShtNames() As Variant Dim i As Integer Set wb = ActiveWorkbook ShtNames = Array("Sheet3", "Sheet5", "Sheet9") '<<--- edit sheet names here. You can add or delete sheet names as well but have at least two for the array. For i = 0 To UBound(ShtNames) wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible Next i Application.ScreenUpdating = True End Sub
Then, if you had a second checkbox to control several other sheets, you could duplicate the above macro and edit the sheet names to required.
Option Explicit
Sub CheckSht()
If ThisWorkbook.Worksheets(1).Shapes("Check Box 1").OLEFormat.Object.Value = 1 Then
Sheets("Sheet3").Visible = False
Else
Sheets("Sheet3").Visible = True
End If
End Sub
Sheets("Sheet5").Visible = False
Else
Sheets("Sheet5").Visible = True
Sheets("Sheet6").Visible = False
Else
Sheets("Sheet6").Visible = True
.
Ok .. then try this :
Code:Option Explicit Sub CheckSht() If ThisWorkbook.Worksheets(1).Shapes("Check Box 1").OLEFormat.Object.Value = 1 Then Sheets("Sheet3").Visible = False Else Sheets("Sheet3").Visible = True End If End Sub
For CheckBox1 name the sub Sub CheckSht1()
For Checkbox2 name the sub Sub CheckSht2()
etc.
etc.
Edit this portion to the sheet corresponding to the Checkbox :
Code:Sheets("Sheet5").Visible = False Else Sheets("Sheet5").Visible = True
Then for the next sheet :
Code:Sheets("Sheet6").Visible = False Else Sheets("Sheet6").Visible = True
.
This is one way ...
Well ... if you are wanting one checkbox to hide/unhide several sheets at once you can use this macro :
Code:Sub ToggleHideUnhideDataSheets() Application.ScreenUpdating = False Dim wb As Workbook Dim ShtNames() As Variant Dim i As Integer Set wb = ActiveWorkbook ShtNames = Array("Sheet3", "Sheet5", "Sheet9") '<<--- edit sheet names here. You can add or delete sheet names as well but have at least two for the array. For i = 0 To UBound(ShtNames) wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible Next i Application.ScreenUpdating = True End Sub
Then, if you had a second checkbox to control several other sheets, you could duplicate the above macro and edit the sheet names to required.