Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Errors + Error Handling _ Lastrow Error Object Required

Posted by: jalopez453 Oct 10 2019, 04:18 PM

I cannot figure out where my code is wrong and why I keep getting this error on the auto-fill to last row.
I want to Enter two formulas into two rows starting from row 10 to the last row.

Dim xlApp As Object
Dim lRow1 As Long
Set xlApp = CreateObject("Excel.Application")

With xlApp
    .Visible = True
    .Workbooks.Open Filename
    .ActiveCell.CopyFromRecordset rstCHR

        strFormulas(1) = "=SUMIF(Charity_Line20!$A:$A,E10,Charity_Line20!$D:$D)"
        strFormulas(2) = "=SUMIF(Charity_Line22!$A:$A,E10,Charity_Line22!$G:$G)"
            lRow1 = .Sheets("Sheet1").Cells(.Rows.Count, "U").End(xlUp).Row
        .Range("V10:W" & lRow1).AutoFill = strFormulas

I have been hat this for a good hour, and I cannot see where I am wrong and it is not working. frown.gif

Posted by: theDBguy Oct 10 2019, 04:52 PM

Just FYI...