This Copy instruction getting Subscript out of Range error 9 - 1st 2 of these 3 stmts worked great

Al Bailey 1 Reputation point
2022-02-20T20:48:32.617+00:00

Workbooks.Open "E:\POS2INV\InvSys.xlsm" 'open rcvr fldr&wkbk, empty rcvr sheet1, & copy sndr sheet to rcvr sheet
Workbooks("InvSys").Worksheets("Sheet1").Cells.ClearContents
Workbooks("getPOSplants").Worksheets("pivot").Range("A1:L" & lastrow).Copy _
Workbooks("InvSys").Worksheets("Sheet1").Range("A1")

Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,705 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-02-20T21:09:34.043+00:00

    Set a breakpoint and check the value of lastrow is valid and expected.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.