ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Preserving number format in userform textbox (https://www.excelbanter.com/excel-programming/436738-preserving-number-format-userform-textbox.html)

Roger on Excel

Preserving number format in userform textbox
 
Is there a way to preserve the number format that is in a userform text box
to be the same as the formatting in the sheet source cell

For example 85% in the sheet (percent format) reads 0.85 in the text box
that reads from that cell

Can anyone help?



Jacob Skaria

Preserving number format in userform textbox
 
Try

Set rng = Range("A1")
TextBox1 = Format(rng,rng.NumberFormat)

If this post helps click Yes
---------------
Jacob Skaria


"Roger on Excel" wrote:

Is there a way to preserve the number format that is in a userform text box
to be the same as the formatting in the sheet source cell

For example 85% in the sheet (percent format) reads 0.85 in the text box
that reads from that cell

Can anyone help?



Rick Rothstein

Preserving number format in userform textbox
 
You can always assign the Text property of the range to the TextBox...

TextBox1.Value = Range("A1").Text

--
Rick (MVP - Excel)


"Roger on Excel" wrote in message
...
Is there a way to preserve the number format that is in a userform text
box
to be the same as the formatting in the sheet source cell

For example 85% in the sheet (percent format) reads 0.85 in the text box
that reads from that cell

Can anyone help?





All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com