Toggling display

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

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
 
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
 
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
 
Back
Top