ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox.caption question (https://www.excelbanter.com/excel-programming/318166-textbox-caption-question.html)

CG Rosén

textbox.caption question
 
Good Morning Group,

Have some problem with a presentation of values in a textbox.
The code below works fine and presents the values in a Textbox in UserForm1.
The Cells(1,1) is formated as 'number' with 2 decimals. When the value in
the cell is of the type xxxx,00 (the decimal values are zero) the Textbox
does not show this, but just xxxx. Is there a way to have the Textbox to
show these decimals even if they are zero?

Brgds

CG Rosén

n = Application.WorksheetFunction.Sum(Sheets(1).Range( Sheets(1).Cells(r, 1),
Sheets(1).Cells(r, 20)))

Worksheets(2).Cells(1, 1) = n

UserForm1.Label1.Caption = Round(Worksheets(2).Cells(1, 1), 2)



Shailesh Shah[_2_]

textbox.caption question
 
Try this,

UserForm1.Label1.Caption = Format(Round(Cells(1, 1), 2), "#,###.00")

Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 07:22 PM.

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