Reputation: 163
I'm querying a SQL db from excel using vba, that all works fine but it also returns and displays the SQL columns headers in the excel sheet. Like this:
AssetTag Machine Name UserName Current Site Run Count Defered
AssetTag MachineName UserName CurrentSite RunCount DeferCount
B33CWM1 QRLXPB33CWM1 admin-03 QR 255 3
Is there a way to get VBA not to display the SQL Column headers?
Upvotes: 0
Views: 477
Reputation: 91356
If you use ADO to create a recordset, you can use CopyFromRecordset in Excel. This does not include headers.
Worksheets("Sheet3").Cells(2, 1).CopyFromRecordset rs
Upvotes: 2