Dynamic Checkbox title and sheet hide function

Gilesth

New Member
Joined
Aug 14, 2003
Messages
37
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.

Sheet IndexSheet NameShow/Hide
1Controls-
2Page 1 CheckBox labeled Page 1
3Page 2Button copied from above references row 3
 

Attachments

  • Screenshot 2023-08-08 180058.png
    Screenshot 2023-08-08 180058.png
    9.4 KB · Views: 9

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I do not believe using checkboxes like this is a good ideal.
I believe you should use Double click function.
Double click on a certain cell and the script runs.
And what is an index number?
You said: "index number from A2."

Why not tell me the objective here the final result you want.
Here you said: you want sheet hidden when you do something.
why not hide active sheet when you double click a cell for example.
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top