Custom Formating for User Form Text Box

bisel

Board Regular
Joined
Jan 4, 2010
Messages
223
Office Version
  1. 365
Platform
  1. Windows
Hello All,

I am hoping someone might be able to help with some VBA to apply custom formatting for a text box on an user form.

I have a user form called, "controlpanel". I use the AFterUpdate event on a text box with this line of VBA

Code:
controlpanel.startreserve_textbox.Value = Format$(controlpanel.startreserve_textbox.Value, "$##,###,##0")

Where controlpanel is the name of the user form and startreserve_textbox is the name of the text box on the form. This works fine. When the user makes a change to that text box, it updates the ControlSource and applies the currency format to the text in the text box.

Now, what I would like to do is be able to apply that formatting from the worksheet. In other words, if the user were to update the cell itself (on the worksheet) use the change event on the worksheet to apply formatting to the user form text box. However, when I insert the above code as a change event in the worksheet, nothing happens. It updates the text value in the in the user form text box, but it does not apply formatting.

If someone could explain the error of my ways, I would greatly appreciate it.

Regards,

Steve
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,457
Messages
6,124,941
Members
449,197
Latest member
k_bs

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