MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Format linked data in userform


Posted by Alex Shahidi on January 28, 2002 9:13 AM

I need help formatting data that is linked to a cell and is displayed in a userform.

Ex:

A1 = 1,000,000

I want to display 1,000,000 in a userform linked to A1, but I can't figure out how to get the commas in there. Right now I just see 1000000. Thank you.

Alex


Posted by Juan Pablo G. on January 28, 2002 9:49 AM

Don't link them

At

UserForm1_Initialize()

read the value of the cell and format it, something like

TextBox1 = Format(Range("A1"),"#,##0.00")

then, when you're closing/updating/whatever your userform, reverse this

Range("A1") = TextBox1 + 0 'This to return a value, not a string

Juan Pablo G.