Reselecting a check box

Nicotp4

New Member
Joined
Jun 7, 2017
Messages
2
Hi

I am new to this site, and I am not normally working in VBA excel (IT Project Management), so I was hoping for some help here :-)

I am currently making a template for the customer to fill out, and they have asked for the opportunity to select a check box multiple times. Right now, all the sheets are hidden, until You select a specific check box, a sheet will appear. But... I simply can't figure out how to make a check box be deselected (then the sheet gets hidden again) and when selected again a new "fresh" sheet appears, but the "old" sheet is still saved.

I hope this is not described too complicated :-D
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
If I understand correctly you want.

When Checkbox1 is checked you want sheet(4).visible=True
When Checkbox1 is not checked you want sheet(4).visible=False and:
You wanted a new blank sheet created.

If that is what you want try this:

Modify script as needed.

Code:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then Sheets(4).Visible = True
If CheckBox1.Value = False Then
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "New " & Sheets(Sheets.Count).Index
Sheets(4).Visible = False
End If
End Sub
 
Upvote 0
Hi

Thanks for your reply.

Not exactly. If fx I want to select "Bananas" which is checkbox1. Then Worksheet "Bananas" will open, when I select it. BUT. If I need to make two different orders on bananas in the same template, then I need to deselect checkbox1, and then select it again. Is there a way where the second time I select checkbox1 it opens another sheet (I can make several sheets named Bananas if required).

Hope this clarifies my special needs :-D
 
Upvote 0
I do not know of any way to tell a check box if I select you one time do this and then the next time I select you do this.

Check boxes are normally used as on and off switches.
The same with Option buttons

Why not use a listbox.

Then the user selects a value from the listbox.

This would then only require one list box and not a large number of named Check boxes.

And you can only have one sheet named "Banana"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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