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

Hello, I am trying to do the following:
When I press the command button, the statement "Market Order" appears
in cell B1, however when I press it again it will remove the statement
"Market Order". Sort of like an on and off switch.

I have written the following so far, however I am having trouble in
removing the statement when I press the command button again.

Your help is appreciated

Private Sub CommandButton1_Click()
If CommandButton1.Value = True Then
Range("B1").Value = "Market Order"
Else
Range("B1").Value = ""
End if
End Sub


Thank you

Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Command Button

Private Sub CommandButton1_Click()
If CommandButton1.Value = True and Range("B1").value ="" Then
Range("B1").Value = "Market Order"
If CommandButton1.Value = True and Range("B1").value <"" Then
Range("B1").Value = ""
End Sub

wrote in message
...
Hello, I am trying to do the following:
When I press the command button, the statement "Market Order" appears
in cell B1, however when I press it again it will remove the statement
"Market Order". Sort of like an on and off switch.

I have written the following so far, however I am having trouble in
removing the statement when I press the command button again.

Your help is appreciated

Private Sub CommandButton1_Click()
If CommandButton1.Value = True Then
Range("B1").Value = "Market Order"
Else
Range("B1").Value = ""
End if
End Sub


Thank you

Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Command Button

Give this a try...
Private Sub CommandButton1_Click()
If Len(Me.Range("B1")) 0 Then
Me.Range("B1").Value = vbNullString
Else
Me.Range("B1").Value = "Market Order"
End If
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



wrote in message
Hello, I am trying to do the following:
When I press the command button, the statement "Market Order" appears
in cell B1, however when I press it again it will remove the statement
"Market Order". Sort of like an on and off switch.

I have written the following so far, however I am having trouble in
removing the statement when I press the command button again.

Your help is appreciated

Private Sub CommandButton1_Click()
If CommandButton1.Value = True Then
Range("B1").Value = "Market Order"
Else
Range("B1").Value = ""
End if
End Sub
Thank you
Mike
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
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
VB's Command Button vs Form's Command Button Ronald Dodge Excel Programming 3 May 24th 06 02:23 PM
Command Button vs Form Button Bri[_3_] Excel Programming 2 February 3rd 06 08:18 AM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


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

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"