Hi Guy's and happy new year to all
I have a question, i am using the following code to output DAO Recordset (rs11) to the excel sheet, what i am after doing is having Column I (row 3), (Field7) (not the actual field name, i have added so the correct fields are not listed here) to say YES in I3, if there are for example 14 records in recordset in rs11, the sheet is filled in from rows 3 to 17 up
I am trying to find the last row used and fill in 14 x YES into each cell in column I row 3 down to I17 (14 records)
I may well have explained this poorly, forgive if so
Note all Dims are set lRow is set as Long
Cells 3,8 are not adding yes in ?
Code:
Set apXL = CreateObject("Excel.Application")Set xLWB = apXL.Workbooks.Open(hpOpen & hfOpen)
apXL.ActiveWorkbook.SaveAs hpSave & hfSave
apXL.Workbooks.Open hpSave & hfSave, True, False
apXL.Visible = False
With xLWB
.Worksheets(1).Cells(3, 3).CopyFromRecordset rs11
LRow = .Worksheets(1).Cells(Worksheets(1).Rows.Count, 3).End(xlUp).Row
.Worksheets(1).Cells(3, 8 + rs11.RecordCount).Value = "YES"
.Save
xLWB.Close
apXL.Quit
Set apXL = Nothing
End With
This is an example of the Excel Template file, i have manually typed YES in the Column