Button from Control Box

J

JMay

I have a button created from the ControlBox that has in its Caption
properties HIDE.
The Hide Button looks very rich (dark and bold) as is (When I open the
Workbook).
It is working Ok based on the code below.
Only problem is when I click it (Hide) it hides columns DFJ and L and
changes to UNHIDE, but the UNHIDE box now looks anemic, the borders
especially (with the grayed-out look).. What am I missing to have it look
comparable to my HIDE button look?


Private Sub ToggleButton1_Click()
With Range("D:D,F:F,J:J,L:L")
If ToggleButton1.Value = True Then
.EntireColumn.Hidden = True
ToggleButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
ToggleButton1.Caption = "Hide"
End If
End With
End Sub
 
T

Tom Ogilvy

That is how it makes it looked depressed. If you don't want that effect,
use a commandbutton.
 
D

Dick Kusleika

JMay

That's how ToggleButtons are supposed to work. It gives you a visual
identifier of what the value of the ToggleButton is: Normal = True, Anemic =
False.

If you want it to look normal all the time (with only the caption changing),
use a CommandButton instead of a ToggleButton.

Private Sub CommandButton1_Click()

With Me.Range("D:D,F:F,J:J,L:L")
If Me.CommandButton1.Caption = "Hide" Then
.EntireColumn.Hidden = True
Me.CommandButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
Me.CommandButton1.Caption = "Hide"
End If
End With

End Sub
 
J

JMay

Tks Tom and Dick;

Dick Kusleika said:
JMay

That's how ToggleButtons are supposed to work. It gives you a visual
identifier of what the value of the ToggleButton is: Normal = True, Anemic =
False.

If you want it to look normal all the time (with only the caption changing),
use a CommandButton instead of a ToggleButton.

Private Sub CommandButton1_Click()

With Me.Range("D:D,F:F,J:J,L:L")
If Me.CommandButton1.Caption = "Hide" Then
.EntireColumn.Hidden = True
Me.CommandButton1.Caption = "Unhide"
Else
.EntireColumn.Hidden = False
Me.CommandButton1.Caption = "Hide"
End If
End With

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.
 

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

Top