Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default click buttons to do, re-click to un-do

Hello all,

I would like to add a button in a spreadsheet and have it do a
operation when cliked and undo the same operation when clicked again.

how do I do this?

Could someone help me write the code?

Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default click buttons to do, re-click to un-do

Hi
one way: Declare a static variable. e.g.

----
Private Sub CommandButton1_Click()
Static status As Boolean
If status Then
' your code for undoing something
CommandButton1.Caption = "Do something"
status = False
Else
' your code for doing something
CommandButton1.Caption = "Undo something"
status = True
End If

End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Hello all,

I would like to add a button in a spreadsheet and have it do an
operation when cliked and undo the same operation when clicked again.

how do I do this?

Could someone help me write the code?

Thanks


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default click buttons to do, re-click to un-do

Add a checkbox instead of a button and test its value for True/False

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"arciduca79 " wrote in message
...
Hello all,

I would like to add a button in a spreadsheet and have it do an
operation when cliked and undo the same operation when clicked again.

how do I do this?

Could someone help me write the code?

Thanks


---
Message posted from http://www.ExcelForum.com/



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
My Buttons shrink with every click [email protected] Excel Worksheet Functions 3 April 3rd 07 07:10 PM
I click on something and my Macro buttons disappered. Help. Colleen New Users to Excel 5 December 19th 05 06:06 PM
Control toolbox Buttons disappear on click Mangesh Yadav Excel Discussion (Misc queries) 2 September 16th 05 05:38 AM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM
edit the buttons in right click menu jc_pace Excel Worksheet Functions 1 November 16th 04 06:51 PM


All times are GMT +1. The time now is 08:50 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"