L
Lee
He everyone,
I know I'm being totally dim here but I've just got a
mental block about this. Below is part of some code to
insert the results of a query into an Excel worksheet.
My problem is I want the process to start from the 2nd
row onwards rather than row 1 as there are column labels
in row 1.
What am I doing wrong here? Here's the code extract:
column = 1
' Loop through the Microsoft Access field names and create
' the Microsoft Excel labels.
For row = 0 To Rs.Fields.Count - 1
CurrentValue = Rs.Fields(row).Name
Sheet.cells(row + 1, column).Value = CurrentValue
Next row
column = 2
' Loop through the Microsoft Access records and copy the
records
' to the Microsoft Excel spreadsheet.
Do Until Rs.EOF
For row = 0 To Rs.Fields.Count - 1
CurrentField = Rs(row)
Sheet.cells(row + 1, column).Value = CurrentField
Next row
Rs.MoveNext
row = row + 1
Loop
Any help would be really appreciated.
Thanks!!
Lee
I know I'm being totally dim here but I've just got a
mental block about this. Below is part of some code to
insert the results of a query into an Excel worksheet.
My problem is I want the process to start from the 2nd
row onwards rather than row 1 as there are column labels
in row 1.
What am I doing wrong here? Here's the code extract:
column = 1
' Loop through the Microsoft Access field names and create
' the Microsoft Excel labels.
For row = 0 To Rs.Fields.Count - 1
CurrentValue = Rs.Fields(row).Name
Sheet.cells(row + 1, column).Value = CurrentValue
Next row
column = 2
' Loop through the Microsoft Access records and copy the
records
' to the Microsoft Excel spreadsheet.
Do Until Rs.EOF
For row = 0 To Rs.Fields.Count - 1
CurrentField = Rs(row)
Sheet.cells(row + 1, column).Value = CurrentField
Next row
Rs.MoveNext
row = row + 1
Loop
Any help would be really appreciated.
Thanks!!
Lee