Formatting text boxes

Mkammari

Board Regular
Joined
Nov 23, 2005
Messages
65
I am using a vba userform to display information that already exists on an excel worksheet entitled "Customer Info". Currently, I am having a very hard time trying to get the userform to display any kind of number formatting. I was using the control source to display the information on the userform but had problems. So then, I tried to code the data in VBA initializing, but still could not get it to work.

Here is one example of my coding in the userform initializing stage.

Code:
TxtWeightLow.text = Sheets("customerinfo").Range("b95").Text

Is there another line I would need to add to format the text box. (the cell on the spreadsheet is already formatted)

I would like txtweightlow to read as a ($* #,##0.00_)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
That code should display B95 in the textbox as it is formatted on the worksheet.

Have you removed the value in the ControlSource property?
 

Mkammari

Board Regular
Joined
Nov 23, 2005
Messages
65
Not really sure what's going on now. I took the control source, the value, and the text out of the properties menu and now I'm not returning a value in the text box.

But the code I provided should return the value exactly displayed in the worksheet. Is that what you are saying?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,117
Messages
5,857,482
Members
431,882
Latest member
saaaaaaaaaaaaaaaaaaaaaa

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