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_)
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,118,056
Messages
5,569,951
Members
412,299
Latest member
agentless
Top