ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help using a toggle button (https://www.excelbanter.com/excel-programming/365681-need-help-using-toggle-button.html)

tanktata[_6_]

Need help using a toggle button
 

Hello,

I am trying to create a spreadsheet in excel 2003, which has a toggl
button on it. When I press the button, I want the sheet to display tw
different sets of data, for example, display data in ColumnA and hid
ColumnC and vice versa.

I am also trying to add protection to the sheet so that when ColumnA i
shown, the rest of the sheet is protected, so no data in ColumnC can b
deleted accidentally.

I think it should be really easy, but I cannot get it work. :(

Can anyone provide any assistance?

Thanks in advance

--
tanktat
-----------------------------------------------------------------------
tanktata's Profile: http://www.excelforum.com/member.php...nfo&userid=459
View this thread: http://www.excelforum.com/showthread.php?threadid=55656


Bearacade[_28_]

Need help using a toggle button
 

Columns("C:C").Select
Selection.EntireColumn.Hidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True

HT

--
Bearacad

-----------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...fo&userid=3501
View this thread: http://www.excelforum.com/showthread.php?threadid=55656


Chip Pearson

Need help using a toggle button
 
Try something like in the sheet's code module.

Private Sub ToggleButton1_Click()
If Me.ToggleButton1.Value = True Then
Me.Columns("A").Hidden = False
Me.Columns("C").Hidden = True
Else
Me.Columns("A").Hidden = True
Me.Columns("C").Hidden = False
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"tanktata"
wrote in
message
...

Hello,

I am trying to create a spreadsheet in excel 2003, which has a
toggle
button on it. When I press the button, I want the sheet to
display two
different sets of data, for example, display data in ColumnA
and hide
ColumnC and vice versa.

I am also trying to add protection to the sheet so that when
ColumnA is
shown, the rest of the sheet is protected, so no data in
ColumnC can be
deleted accidentally.

I think it should be really easy, but I cannot get it work. :(

Can anyone provide any assistance?

Thanks in advance.


--
tanktata
------------------------------------------------------------------------
tanktata's Profile:
http://www.excelforum.com/member.php...fo&userid=4598
View this thread:
http://www.excelforum.com/showthread...hreadid=556566




tanktata[_7_]

Need help using a toggle button
 

Thanks for the help so far. The code you have given only hides an
unhides the data.

Its the protection of the data that I cant really seem to get working

--
tanktat
-----------------------------------------------------------------------
tanktata's Profile: http://www.excelforum.com/member.php...nfo&userid=459
View this thread: http://www.excelforum.com/showthread.php?threadid=55656


Bearacade[_29_]

Need help using a toggle button
 

ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=Tru

--
Bearacad

-----------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...fo&userid=3501
View this thread: http://www.excelforum.com/showthread.php?threadid=55656


tanktata[_8_]

Need help using a toggle button
 

I know how to protect a sheet, but I cant get the toggle button t
protect/unprotect a worksheet that contains unlocked cell

--
tanktat
-----------------------------------------------------------------------
tanktata's Profile: http://www.excelforum.com/member.php...nfo&userid=459
View this thread: http://www.excelforum.com/showthread.php?threadid=55656



All times are GMT +1. The time now is 10:26 AM.

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