ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CommandButton Caption change via macro (https://www.excelbanter.com/excel-programming/310625-commandbutton-caption-change-via-macro.html)

PCLIVE

CommandButton Caption change via macro
 
I've got a command button "CommandButton10" in which the formula line shows
=EMBED("Forms.CommandButton.1",""). I guess that's fairly irrelevant.

The caption on the button is "Week 1". The VBA code is:
--------
Private Sub CommandButton10_Click()
Application.Calculation = xlCalculationManual
Range("AA1").Formula = "1"
Range("AG1").Formula = "1"
Application.Run "CreateWeeks"

End Sub
-----------

Is there some coding that I can include above that will change the caption
on CommandButton10 from "Week 1" to "Week 1 Complete"?

Thanks,
Paul



Ron de Bruin

CommandButton Caption change via macro
 
Try this

Me.CommandButton10.Caption = "Week 1 Complete"



--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message ...
I've got a command button "CommandButton10" in which the formula line shows
=EMBED("Forms.CommandButton.1",""). I guess that's fairly irrelevant.

The caption on the button is "Week 1". The VBA code is:
--------
Private Sub CommandButton10_Click()
Application.Calculation = xlCalculationManual
Range("AA1").Formula = "1"
Range("AG1").Formula = "1"
Application.Run "CreateWeeks"

End Sub
-----------

Is there some coding that I can include above that will change the caption
on CommandButton10 from "Week 1" to "Week 1 Complete"?

Thanks,
Paul





Norman Jones

CommandButton Caption change via macro
 
Hi PCLIVE,

Try adding the last line:

If CommandButton10.Caption = "Week 1". Then
CommandButton10.Caption = "Week 1 Complete"
end if

---
Regards,
Norman



"PCLIVE" wrote in message
...
I've got a command button "CommandButton10" in which the formula line
shows
=EMBED("Forms.CommandButton.1",""). I guess that's fairly irrelevant.

The caption on the button is "Week 1". The VBA code is:
--------
Private Sub CommandButton10_Click()
Application.Calculation = xlCalculationManual
Range("AA1").Formula = "1"
Range("AG1").Formula = "1"
Application.Run "CreateWeeks"

End Sub
-----------

Is there some coding that I can include above that will change the caption
on CommandButton10 from "Week 1" to "Week 1 Complete"?

Thanks,
Paul





PCLIVE

CommandButton Caption change via macro
 
Thanks.

That works great!


"Ron de Bruin" wrote in message
...
Try this

Me.CommandButton10.Caption = "Week 1 Complete"



--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message

...
I've got a command button "CommandButton10" in which the formula line

shows
=EMBED("Forms.CommandButton.1",""). I guess that's fairly irrelevant.

The caption on the button is "Week 1". The VBA code is:
--------
Private Sub CommandButton10_Click()
Application.Calculation = xlCalculationManual
Range("AA1").Formula = "1"
Range("AG1").Formula = "1"
Application.Run "CreateWeeks"

End Sub
-----------

Is there some coding that I can include above that will change the

caption
on CommandButton10 from "Week 1" to "Week 1 Complete"?

Thanks,
Paul








All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com