Button text

patnitin

New Member
Joined
Mar 23, 2006
Messages
27
Hi,
I have some buttons in my worksheet which hide and unhide some of the columns on clicking it.I want the text to alternate between signs '+' and '-',based on whether its hiding/unhiding the columns.Inother words I want the button text to shw '+' sign when the columns are to be expanded and sign'-' when the columns are to be hidden.Such kind of application I have seen in many sheets but unable to do it my self.(kindly note the I have wrtten the code for the columns to be hidden/unhide and I want only the button text to change)

Can anybody help!
Thanks in advance.

Regards,
Nitin
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,764
Have you tried the macro recorder? This is what it produces for me

Code:
ActiveSheet.Shapes("Button 1").Select
    Selection.Characters.Text = "Hello"
    With Selection.Characters(Start:=1, Length:=5).Font
        .Name = "NewsGoth BT"
        .FontStyle = "Roman"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
End Sub

Obviously, a lot of the erroneous code could be removed.
 

Forum statistics

Threads
1,141,937
Messages
5,709,430
Members
421,636
Latest member
kelseyacheson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top