Formatting as number on Excel Sheet (1 Viewer)

Eljefegeneo

Still trying to learn
Local time
Today, 02:43
Joined
Jan 10, 2011
Messages
904
I am using a modified version of code to open an excel sheet for viewing. The problem is that I need it be auto fit and text wrapped. The code is a modified version of https://btabdevelopment.com/export-a-forms-recordset-to-excel/
All is well except that three number columns are now only one decimal place instead of two. I have tried almost everything, formatting the query to use Round([FieldName],2) etc. to no avail. When I use the Format([FieldName], 2, "Fixed") the columns are in text form.
As of now I can send the query to file as an Excel sheet with the correct formatting and open it, but it is not auto fixed or auto wrap. Or I can send it to file, open it and have to format the three columns as numbers and auto fit the worksheet.
Is there any way of modifying the code to say something like
Code:
  With ApXL.Selection.Number
 

June7

AWF VIP
Local time
Today, 01:43
Joined
Mar 9, 2014
Messages
5,463
If you use Excel macro recorder, it will give you code like:

Columns("A:A").Select
Selection.NumberFormat = "0.00"

So adapt that.
 

Users who are viewing this thread

Top Bottom