Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
geb geb is offline
external usenet poster
 
Posts: 19
Default Toggle command buttons

I have an "Analysis" and a "Clear" button.
At first I only want the "Analysis" button to be active
and the "Clear" button disabled.
After the "Analysis" button is clicked I want the reverse, and
so on (toggle).
I didn't see any code window for the controls.
How can I code this?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Toggle command buttons

Where did you get the controls from the Forms toolbar or the control
toolbox.

--
HTH

Bob Phillips

"GEB" wrote in message
...
I have an "Analysis" and a "Clear" button.
At first I only want the "Analysis" button to be active
and the "Clear" button disabled.
After the "Analysis" button is clicked I want the reverse, and
so on (toggle).
I didn't see any code window for the controls.
How can I code this?




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


If the buttons are from the control toolbox then the code would be
placed on the code window behind the worksheet on which the buttons
reside.

You can get the buttons to 'toggle' with the following code


Code:
--------------------
Private Sub CommandButton1_Click()
CommandButton1.Enabled = False
CommandButton2.Enabled = True
'Your code here
End Sub

Private Sub CommandButton2_Click()
CommandButton2.Enabled = False
CommandButton1.Enabled = True
'Your code here
End Sub
--------------------


You could also use a single button and have it's caption change with
each click and then the action taken depend on the value of the
caption.


Code:
--------------------
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Analysis" Then
CommandButton1.Caption = "Clear"
'your analysis code here
Exit Sub
End If
If CommandButton1.Caption = "Clear" Then
CommandButton1.Caption = "Analysis"
'your clear code here
Exit Sub
End If
End Sub
--------------------


HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=381663

  #4   Report Post  
Posted to microsoft.public.excel.programming
geb geb is offline
external usenet poster
 
Posts: 19
Default Toggle command buttons

From the Forms toolbar.

"Bob Phillips" wrote:

Where did you get the controls from the Forms toolbar or the control
toolbox.

--
HTH

Bob Phillips

"GEB" wrote in message
...
I have an "Analysis" and a "Clear" button.
At first I only want the "Analysis" button to be active
and the "Clear" button disabled.
After the "Analysis" button is clicked I want the reverse, and
so on (toggle).
I didn't see any code window for the controls.
How can I code this?





  #5   Report Post  
Posted to microsoft.public.excel.programming
geb geb is offline
external usenet poster
 
Posts: 19
Default Toggle command buttons

OK, I replaced the forms buttons with ones from the control toolbox
and was able to code them.

Thanks for your help.

"GEB" wrote:

From the Forms toolbar.

"Bob Phillips" wrote:

Where did you get the controls from the Forms toolbar or the control
toolbox.

--
HTH

Bob Phillips

"GEB" wrote in message
...
I have an "Analysis" and a "Clear" button.
At first I only want the "Analysis" button to be active
and the "Clear" button disabled.
After the "Analysis" button is clicked I want the reverse, and
so on (toggle).
I didn't see any code window for the controls.
How can I code this?





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
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
Colouring Stuff, Toggle Buttons Momo Excel Programming 2 February 9th 05 03:19 PM
Toggle Buttons Momo Excel Programming 2 February 9th 05 01:35 PM
multiple toggle buttons Nelson Excel Programming 3 November 2nd 04 08:27 AM
How can I use the Spin or Toggle buttons to change cell values PKyle Excel Programming 1 April 7th 04 10:39 PM


All times are GMT +1. The time now is 10:56 PM.

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

About Us

"It's about Microsoft Excel"