Hi,
I am fetching data from the ADO connection to my excel cell using code
Here while displaying my table having 0.00 as value is changes to 0, how can i retain its format when displayed in VBA?Please Login or Register to view this content.
Hi,
I am fetching data from the ADO connection to my excel cell using code
Here while displaying my table having 0.00 as value is changes to 0, how can i retain its format when displayed in VBA?Please Login or Register to view this content.
You can add a line of code, something like
Selection.NumberFormat = "#,##0.00"
Change the Selection Part to the way you would want to refer to the range..
There are many different ways.. This is just one of it.
Last edited by NeedForExcel; 06-02-2015 at 02:30 AM.
Cheers!
Deep Dave
For this i feel i have to format a precise cells, where as my data place can be changed tomorrow as table column adds. Is there any general way of doing it?
You can then include it in the FOR Loop Which you have up there..
That should be feasible?
Something like -
Note: Not very sure which cells actually need to be formatted as 0.00..Please Login or Register to view this content.
Last edited by NeedForExcel; 06-02-2015 at 02:42 AM.
Here is the code i added:
After finding the field data type it will be easier to format as you suggested.Please Login or Register to view this content.
True!
So did it work?
Indeed... more info can be get from "https://support.microsoft.com/en-us/kb/193947"
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks