Reputation: 2348
I have a string like "2,345".I want to put it into a excel cell.I successfully did but in my excel file i got "2,345" as a string.So please suggest me how can i get "2,345" as a number value but with the same format as i used above(comma seperated).
Thanks in advance.
Upvotes: 0
Views: 98
Reputation: 19367
Remove the comma before inserting it into Excel, cast it to a number before inserting, then format the column to show the comma.
In Excel the code to format a Range
with commas is:
SomeRange.Style = "Comma" 'or, recorded version
SomeRange.NumberFormat = "_-* #,##0_-;-* #,##0_-;_-* ""-""??_-;_-@_-"
'a simpler version..
SomeRange.NumberFormat = "#,##0"
Upvotes: 1