![]() |
Change macro button text when macro is invoked.
In xl2007, I created a simple macro to hide or unhide columns [Columns("H:L").EntireColumn.Hidden = Not Columns("H:L").EntireColumn.Hidden]. I inserted a "Button - Form Control" to invoke it. It works fine. The text on the button is "Show Rate". I was wondering if there was a way to make the text change, depending on the state of the columns, so if they were hidden, the button text would read "Show Rate", and if the were unhidden, the button text would read "Hide Rate. As i said, the macro works fine...I was just wondering if this was possible, and if so, how?
Thanks, Tonso |
Change macro button text when macro is invoked.
Hi,
Am Mon, 5 Nov 2012 06:44:35 -0800 (PST) schrieb Tonso: In xl2007, I created a simple macro to hide or unhide columns [Columns("H:L").EntireColumn.Hidden = Not Columns("H:L").EntireColumn.Hidden]. I inserted a "Button - Form Control" to invoke it. It works fine. The text on the button is "Show Rate". I was wondering if there was a way to make the text change, depending on the state of the columns, so if they were hidden, the button text would read "Show Rate", and if the were unhidden, the button text would read "Hide Rate. As i said, the macro works fine...I was just wondering if this was possible, and if so, how? do it with an activeX button: Private Sub CommandButton1_Click() Columns("H:L").EntireColumn.Hidden = _ Not Columns("H:L").EntireColumn.Hidden CommandButton1.Caption = IIf(Columns("H:L").EntireColumn.Hidden, _ "Show Rate", "Hide Rate") End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Change macro button text when macro is invoked.
On Monday, November 5, 2012 9:44:35 AM UTC-5, Tonso wrote:
In xl2007, I created a simple macro to hide or unhide columns [Columns("H:L").EntireColumn.Hidden = Not Columns("H:L").EntireColumn.Hidden]. I inserted a "Button - Form Control" to invoke it. It works fine. The text on the button is "Show Rate". I was wondering if there was a way to make the text change, depending on the state of the columns, so if they were hidden, the button text would read "Show Rate", and if the were unhidden, the button text would read "Hide Rate. As i said, the macro works fine...I was just wondering if this was possible, and if so, how? Thanks, Tonso Claus, Thank you so much! That works great! Thanks again... Tonso |
All times are GMT +1. The time now is 05:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com