1

I want to select the row before the last row, auto fill down to the row below the last row. For some reason the Destination Rows does not like the format of the named range. Here is my code which receives an error:

Sub Range_Find_Method()

Dim lRow As Long
lRow = Cells.Find(What:="*", _
                After:=Range("A1"), _
                LookAt:=xlPart, _
                LookIn:=xlFormulas, _
                SearchOrder:=xlByRows, _
                SearchDirection:=xlPrevious, _
                MatchCase:=False).Row
Rows(lRow - 1).Select   
    Selection.AutoFill Destination:=Rows(lRow - 1 : lRow + 1), Type:=xlFillDefault


End Sub
Vityata
  • 42,633
  • 8
  • 55
  • 100
kdudeIA
  • 57
  • 1
  • 6

1 Answers1

3

This is the correct syntax:

Selection.AutoFill Destination:=Rows(lRow - 1 & ":" & lRow + 1), Type:=xlFillDefault

As a next step, try avoiding Select and Selection - How to avoid using Select in Excel VBA, if you feel like it.

Vityata
  • 42,633
  • 8
  • 55
  • 100