Hello Mates,
When you work with Userform in Excel VBA, usually sometimes you need to retrieve or reflect currency figure in the Userform (Like in Textbox, in Label or in Listbox) from the range(s) of the workbook.
When you directly assign values to the objects, Userform generally takes it as a number and never reflect the proper format that you required in as Indian or else country's currency's format.
So, I have struggled a lot to find the solution indeed. After a constantly looking for the solution of this, I came across to the following worksheet function.
It's ".Text" formula
Yes, here's the Syntax:
userform1.textbox1.value = Application.WorksheetFunction.Text(VariableName.value, "[>=10000000]##\,##\,##\,##0.0#;[>=100000] ##\,##\,##0.0#;##,##0.0#")
Thank you.
- Kamal Bharakhda
Or try the native VBA "Format" function
ReplyDeleteThank you so much for the suggestion. But Format Function is a way too known function for the VBA developers. I have tried this with Format function only in the startup. but I couldn't get the result that Text function provided me. So...
Delete