0

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
2
  • (note: the online indenter is case-sensitive, that lowercase next is confusing it) Commented Oct 16, 2017 at 18:10
  • sorry, my typo. actually Excel check it and change it if needed. Activating sheet doesn't help, since all other scripts are working fine. Also "IDENT" didn't caught this low case typo. Commented Oct 17, 2017 at 3:29

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

4 Comments

RTE 424 Object required . and I think, it's a part after 'Cut'
Did you change Sheet1 to Sheet5, and Sheet2 to Sheet61 in my code sample above? Do you have Option Explicit at the beginning of your module? Have you compiled your code?
everything is correct in code now, but I didn't use Explicit. different sheets, it's just trying different ways.
this code worked year ago, but now... Cut & Paste to another sheet is main task. Found strange thinks like, while fixing code and trying different thinks, cut&copied to sheet 6 it didn't work, renamed to sheet61, again didn't work, created new sheet and it is sheet11, it worked until I deleted (cleared) results by choosing colums & del them. created another new sheet12 and deleted results by choosing cells with data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.