ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   checkboxes hiding or introducing new worksheets (https://www.excelbanter.com/excel-programming/314192-checkboxes-hiding-introducing-new-worksheets.html)

el_peacock[_2_]

checkboxes hiding or introducing new worksheets
 
Hi, I'll try and keep this brief!
I'd like to be able to control the visibility of certain sheets within my
workbook using checkboxes. I.e. on one worksheet is a index of items which
each have a separate worksheet dedicated to them. Is it possible to control
the visibility of these individual sheets by the user ticking the checkbox
next to the related item on the index sheet?
I tried assigning the following code to a forms checkbox, but get a 424
error on the second line:

Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Item 1").Visible = True
Else
Sheets("Item 1").Visible = False
End If
End Sub

What am I doing wrong (I'm a bit of an amateur!)??!

Also, thought I'd ask this but really don't know if it's possible: Can I use
the same above checkbox to import a worksheet from another file when checked?
This would be a major advantage in keeping file size down rather than having
a dozen hidden sheets?!
Thanks for all/any help
Gareth

Bob Phillips[_6_]

checkboxes hiding or introducing new worksheets
 
Works fine for me.

Are you sure that you used control toolbox checkboxes, and you put the code
in the worksheet module?

--

HTH

RP

"el_peacock" wrote in message
...
Hi, I'll try and keep this brief!
I'd like to be able to control the visibility of certain sheets within my
workbook using checkboxes. I.e. on one worksheet is a index of items

which
each have a separate worksheet dedicated to them. Is it possible to

control
the visibility of these individual sheets by the user ticking the checkbox
next to the related item on the index sheet?
I tried assigning the following code to a forms checkbox, but get a 424
error on the second line:

Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Item 1").Visible = True
Else
Sheets("Item 1").Visible = False
End If
End Sub

What am I doing wrong (I'm a bit of an amateur!)??!

Also, thought I'd ask this but really don't know if it's possible: Can I

use
the same above checkbox to import a worksheet from another file when

checked?
This would be a major advantage in keeping file size down rather than

having
a dozen hidden sheets?!
Thanks for all/any help
Gareth




el_peacock

checkboxes hiding or introducing new worksheets
 
Ah - I see, I used the code on a control toolbox beckbox and it worked fine
(was using a forms checkbox before)! Cheers for the help.


"Bob Phillips" wrote:

Works fine for me.

Are you sure that you used control toolbox checkboxes, and you put the code
in the worksheet module?

--

HTH

RP

"el_peacock" wrote in message
...
Hi, I'll try and keep this brief!
I'd like to be able to control the visibility of certain sheets within my
workbook using checkboxes. I.e. on one worksheet is a index of items

which
each have a separate worksheet dedicated to them. Is it possible to

control
the visibility of these individual sheets by the user ticking the checkbox
next to the related item on the index sheet?
I tried assigning the following code to a forms checkbox, but get a 424
error on the second line:

Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Item 1").Visible = True
Else
Sheets("Item 1").Visible = False
End If
End Sub

What am I doing wrong (I'm a bit of an amateur!)??!

Also, thought I'd ask this but really don't know if it's possible: Can I

use
the same above checkbox to import a worksheet from another file when

checked?
This would be a major advantage in keeping file size down rather than

having
a dozen hidden sheets?!
Thanks for all/any help
Gareth






All times are GMT +1. The time now is 06:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com