Reputation: 1328
I am copying some data from Access to Excel, using an Excel macro. It is working fine, except that some of the column formats are being changed in the process. The section of code that fills in the worksheet is
ActiveSheet.UsedRange.Clear
'Add the data (note blank line between headers & data
Cells(Crow + 2, CColumn).CopyFromRecordset RS
'Add the field headers
For Each Item In RS.Fields
Cells(Crow, CColumn) = Item.Name
CColumn = CColumn + 1
Next Item
Which is changing the formats - the Clear command in the 1st line, or the CopyFromRecordset? How do I retain the cell formats?
Upvotes: 0
Views: 143