Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Toggle Button


Hi all,

I am looking a putting a VB command button on one of my sheets, which
when pressed once it does one thing, then when pressed again it does
something different.

e.g. when pressed first time it hides a range of rows, when pressed
again it unhides them.

Hope you can help

Dave


--
Dave_2k5
------------------------------------------------------------------------
Dave_2k5's Profile: http://www.excelforum.com/member.php...o&userid=19667
View this thread: http://www.excelforum.com/showthread...hreadid=401061

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Toggle Button


Good morning Dave_2k5

Why not set up a check box from the control toolbox toolbar. Once
you've drawn it on screen double click on it and paste the code below
into the window that opens. Close the window to return to Excel and on
the Control Toolbox bar select Design Mode (top left) to set the
checkbox.

The code shown assumes that your checkbox will be called Checkbox1 and
that you want to hide rows 10 to 15 inclusive.

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Rows("10:15").EntireRow.Hidden = True
Else
Rows("10:15").EntireRow.Hidden = False
End If
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=401061

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Toggle Button


I would do that......But want it to be a button not a checkbox!!

Cheers Anyway

Dave


--
Dave_2k5
------------------------------------------------------------------------
Dave_2k5's Profile: http://www.excelforum.com/member.php...o&userid=19667
View this thread: http://www.excelforum.com/showthread...hreadid=401061

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Toggle Button


Hi Dave

If it HAS to be a button then have a look in the control toolbox -
there is a toggle button. Don't use the forms toolbar because there
isn't one there.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=401061

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle Button Squeaky Excel Worksheet Functions 0 September 17th 08 04:14 PM
Need to Use 1 Button to toggle On or Off Jim May Excel Discussion (Misc queries) 2 December 1st 07 08:01 PM
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle Button Dave_2k5 Excel Discussion (Misc queries) 2 September 1st 05 11:27 AM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM


All times are GMT +1. The time now is 01:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"