Pavigo
Pavigo

Reputation: 91

VBA range object required error

Cant fix this Range.cut error. @ Sheet5.Range(Rows(i), Rows(i + 4)).Cut Sheet61.Range(Rows(i)) Any help appreciated.

Dim i As Long
Dim maxRow As Long

    maxRow = 120
    For i = 20 To maxRow Step 19

    Sheet5.Range(Rows(i), Rows(i + 4)).Cut Sheet61.Range(Rows(i))
next i

Upvotes: 0

Views: 441

Answers (1)

Excelosaurus
Excelosaurus

Reputation: 2849

Rows(i) returns a reference to a range in the active worksheet, so one or the other Range will fail. Prefix Rows by the worksheet's codename:

Sheet1.Range(Sheet1.Rows(i), Sheet1.Rows(i + 4)).Cut Sheet2.Rows(i)

Upvotes: 1

Related Questions