jalopez453
Registered User.
- Local time
- Today, 04:23
- Joined
- Oct 11, 2016
- Messages
- 18
I am trying to auto-fill tow formulas into two columns to the last row on my report. Every things goes thru smoothly until I get to the LastRow formula. I keep getting an error and I don't understand why.
If anyone is able to help me, or see where I am coding it wrong, that would be so helpful. My issues is the lRow1
Code:
Dim xlApp As Object
Dim lRow1 As Long
Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = True
.Workbooks.Open Filename
'Sheet1
.Sheets("Sheet1").Select
.Range("A10").Select
.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
If anyone is able to help me, or see where I am coding it wrong, that would be so helpful. My issues is the lRow1