Hi All!

    
    ActiveCell.Offset(1, -33).Range("A1").Select
    ActiveCell.FormulaR1C1 = "=RC[-1]/(RC[-3]+1)"
    ActiveCell.Select
    Selection.AutoFill Destination:=ActiveCell.Range("A1:A270")
    ActiveCell.Range("A1:lGRow").Select
The code above works perfectly for the range between A1:A270

Now I want to increase the range to cover to the end of the number of rows in the spreadsheet.

To determine the number of rows that are in the spreadsheet, I used this code

Dim lGRow As Long
    
    On Error Resume Next
    lGRow = Cells.Find(What:="*", _
                    After:=Range("A1"), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row
    On Error GoTo 0
It also worked perfectly.

So I changed the code at the top to this...

    ActiveCell.Offset(1, -33).Range("A1").Select
    ActiveCell.FormulaR1C1 = "=RC[-1]/(RC[-3]+1)"
    ActiveCell.Select
    Selection.AutoFill Destination:=ActiveCell.Range("A1:lGRow")
    ActiveCell.Range("A1:lGRow").Select
So the only change is

Selection.AutoFill Destination:=ActiveCell.Range("A1:A270")
to

Selection.AutoFill Destination:=ActiveCell.Range("A1:lGRow")
Now, I get the error, "Run-time error 1004: Application-defined or object-defined error"

Any ideas?

Thanks!