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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,772
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,181,212
Messages
5,928,733
Members
436,625
Latest member
agholson81

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