DanM
DanM

Reputation: 195

how to make my initial workbook activate based on a full pathname

i have the following code, need it to work:

Sheets("BigMaster").Range("A1:z999").Copy
Windows("Z:\Viewpoint\Viewpoint Import\Programs\SheetsForConstructionAndImportingIntoViewpoint - FROZEN.XLSM").Activate
Sheets("BigMaster").Range("A1").Paste

its failing on the activate command. how come?

i have tried to shorten the workbook name but it is still not working. i definitely have the right path though, i took it with windows explorer.

basically i need to copy from bigmaster on my current book to the bigmaster on the activate clause. but i get an error 9 subscript out of range.

what am i doing wrong and how can i fix this macro

Upvotes: 0

Views: 116

Answers (1)

Tim Williams
Tim Williams

Reputation: 166136

Assuming the destination workbook is open - if it's not then you first need to open it

ActiveWorkbook.Sheets("BigMaster").Range("A1:z999").Copy _
  Workbooks("SheetsForConstructionAndImportingIntoViewpoint - FROZEN.XLSM"). _
    Sheets("BigMaster").Range("A1")

Upvotes: 2

Related Questions