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: 11

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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