Results 1 to 15 of 15

Thread: Subscript out of range problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    It's 99% certain to be one of the things mentioned by Okami/myself.

    Try adding these three lines directly after your .Copy line (but before the PasteSpecial line):
    Workbooks("Centris Periods.xlsm").Activate 'errors if you have the workbook name wrong or the book isn't open.
    ActiveWorkbook.Sheets(Sh).Activate 'errors if the sheet name is wrong.
    Range("D15:I214").Select 'this will fail if the code is in a sheet's code module and that sheet isn't Workbooks("Centris Periods.xlsm").Sheets(Sh)
    These three lines are just temporary for debugging, you should remove them later.


    As an aside, both your With…End With blocks are currently redundant; you're missing some dots:
    With ActiveWorkbook.Sheets("INV ACC")
      Set Rng1A =  .Range("D15:I214")
      Set Rng2A =  .Range("M15:W214")
    End With
    With ActiveWorkbook.Sheets("INV INPUT")
      Set Rng1I =  .Range("H15:L214")
      Set Rng2I =  .Range("S15:Y214")
    End With
    Last edited by p45cal; 04-18-2019 at 03:53 AM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •