Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toggle Button from Worksheet to Toolbar? 1

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hello

I'm using Excel 2010. I currently have a button on each worksheet of my workbook which runs the following code to hide/show columns. Is there any way that I can take this code and add it as a toggle on the toolbar so whatever worksheet the user is in it will show/hide as applicable?

Code:
Private Sub ToggleButton1_Click()
If ToggleButton1.Value = False Then
Me.Unprotect
Range("B1:J1").EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide Original"
Me.Protect
Else
Me.Unprotect
Range("B1:J1").EntireColumn.Hidden = True
ToggleButton1.Caption = "Show Original"
Me.Protect

End If

End Sub

Thanks very much.
 
Can't you SELECT without UNPROTECTING?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top