Hello All,
I have a workbook with approx 30 sheets. The sheet names can be amended by the user.
I have an Index calculation that displays the work sheet name and this has the index number in the first column and the worksheet name in the second column
In the third column I want to have a check box, that when unclicked will hide the corresponding sheet.
so 30 sheets listed with 30 buttons, I found an old post that works
Private Sub CheckBox1_Click()
On Error Resume Next
ThisWorkbook.Sheets(2).Visible = CheckBox1.Value
End Sub
- how can I make this dynamic and update the caption for the button to show the tab name?
- Is it possible to amend this so that if the check box was in cell C2, it would take the index number from A2, and display the tab name from B2 as the caption?
- Then the same code could be copied to C3, and that rows reference data would control Sheet index number held in A3.
I have a workbook with approx 30 sheets. The sheet names can be amended by the user.
I have an Index calculation that displays the work sheet name and this has the index number in the first column and the worksheet name in the second column
In the third column I want to have a check box, that when unclicked will hide the corresponding sheet.
so 30 sheets listed with 30 buttons, I found an old post that works
Private Sub CheckBox1_Click()
On Error Resume Next
ThisWorkbook.Sheets(2).Visible = CheckBox1.Value
End Sub
- how can I make this dynamic and update the caption for the button to show the tab name?
- Is it possible to amend this so that if the check box was in cell C2, it would take the index number from A2, and display the tab name from B2 as the caption?
- Then the same code could be copied to C3, and that rows reference data would control Sheet index number held in A3.
Sheet Index | Sheet Name | Show/Hide |
1 | Controls | - |
2 | Page 1 | CheckBox labeled Page 1 |
3 | Page 2 | Button copied from above references row 3 |