VBA code for Toggle

  • Thread starter Thread starter Maria
  • Start date Start date
M

Maria

Hello:
I would appreciate help with this. I have a worksheet on which I have a
textbox. I want to place a toggle button on the worksheet which would show &
hide the textbox & the button text would change from 'Hide' to 'Show' and
vice versa.

TIA
 
Private Sub ToggleButton1_Click()
If ToggleButton1.Value Then
Me.TextBox1.Visible = False
ToggleButton1.Caption = "Show"
Else
Me.TextBox1.Visible = True
ToggleButton1.Caption = "Hide"
End If
End Sub

worked for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top