Using VBA to change ActiveX Button Caption w/Formatting

WSBirch

Board Regular
Joined
Apr 10, 2018
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Good morning!

I've been able to change the caption of my ActiveX Buttons using the below; However, is there no way to change the formatting in the way that the text is displayed?
VBA Code:
Worksheets("Snapshot").CommandButton2.Caption = Worksheets("ValueShipped").Range("Q2")


For context, cell Q2 is a WORKDAY formula then the cell is formatted with a custom "ddd, mmm dd" to display Thu, Sep 14. The VBA to change the caption of the button displays 9/14/2023, but I would like it to display the custom number formatting.
Excel Formula:
WORKDAY(TODAY(),1,ValueShipped!$F$2:$F$300)


I've tried using this VBA but it doesn't work. Throws an error. Is there a way for this to work?
VBA Code:
Worksheets("Snapshot").CommandButton2.Caption = Worksheets("ValueShipped").Range("Q2").NumberFormat = "ddd, mmm dd"
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,215,076
Messages
6,122,988
Members
449,093
Latest member
Mr Hughes

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
Back
Top