Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 49
Default Toggling display

Hi,

Cell B5 is named "status". I'm looking for a macro to be attached to a
button. When I click the button once, it shows the word, "On". Clicking it
again it now shows the word "Off", and continues to toggle. Any help ?

TIA
Tom


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Toggling display

hi
what kind of button? Command button on the sheet?

Private Sub CommandButton1_Click()
If Range("B5").Value = "On" Then
Range("B5").Value = "Off"
Else
Range("B5").Value = "On"
End If
End Sub

regards
FSt1

"Tom" wrote:

Hi,

Cell B5 is named "status". I'm looking for a macro to be attached to a
button. When I click the button once, it shows the word, "On". Clicking it
again it now shows the word "Off", and continues to toggle. Any help ?

TIA
Tom



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Toggling display

Here is one I did a long time ago. Create a shape and NAME it toggleit

Sub chgtextontoggleit()
ActiveSheet.Shapes("toggleit").Select
With Selection
If .Characters.Text = "ON" Then
msg = "OFF"
Else
msg = "ON"
End If
..Characters.Text = msg
End With
Range("a1").Select
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Hi,

Cell B5 is named "status". I'm looking for a macro to be attached to a
button. When I click the button once, it shows the word, "On". Clicking it
again it now shows the word "Off", and continues to toggle. Any help ?

TIA
Tom



  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 49
Default Toggling display

Your efforts are much appreciated Don Guillett and FSt1 once again.

Regards,
Tom


"Tom" wrote in message
...
Hi,

Cell B5 is named "status". I'm looking for a macro to be attached to a
button. When I click the button once, it shows the word, "On". Clicking it
again it now shows the word "Off", and continues to toggle. Any help ?

TIA
Tom




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
Help with toggling display Tom Excel Discussion (Misc queries) 3 June 28th 09 12:55 PM
toggling checkboxes Tony Excel Programming 1 December 9th 08 12:50 AM
toggling between 2 workbooks excelnut1954 Excel Programming 1 October 12th 06 08:31 PM
toggling jlofritts Excel Worksheet Functions 3 March 7th 06 06:34 PM
Toggling Display as Icon for OLE Object [email protected] Excel Programming 0 July 13th 05 09:13 PM


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