0

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

0m3r
  • 12,286
  • 15
  • 35
  • 71
DanM
  • 185
  • 7
  • 2
    You don't need to use `Activate`. I ***highly*** suggest reading, and applying, [how to avoid using `.Select`/`.Activate`](http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros). – BruceWayne Oct 19 '16 at 16:19

1 Answers1

2

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")
Tim Williams
  • 154,628
  • 8
  • 97
  • 125
  • 1
    Note that since the sheets (`"BigMaster"`) is the same name in both workbooks. You may want to avoid `ActiveWorkbook.Sheets("BigMaster")...` just in case the `"SheetsForConstructionandIMportingIntoViewPoint- FROZEN.XLSM"` is the activesheet. – BruceWayne Oct 19 '16 at 16:21