Results 1 to 4 of 4

Thread: *SOLVED* subscript out of range error

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    right here
    Posts
    87

    Resolved *SOLVED* subscript out of range error

    I have made a macro for copy and paste into a new file.
    Copied it into vba editor into my code.
    Worked fine, but not anymore.
    It makes a new file but as soon as it wants to go back to
    "Windows("file.xls").Activate"
    "it gives a suscripts out of range" error
    I have checked for the value of "strBestandMap"
    and "strBestand" both are not changed and are fine.

    This is my code:

    VB Code:
    1. Workbooks.Add
    2.     ChDir strBestandMap
    3.     ActiveWorkbook.SaveAs Filename:=strBestand
    4.     Windows("file.xls").Activate
    5.     Sheets("resultaten").Select
    6.     Cells.Select
    7.     Selection.Copy
    8.     Windows("" & strBestandNaam & "").Activate
    9.     Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
    10.         False, Transpose:=False
    11.     Application.CutCopyMode = False
    12.     Range("A1").Activate
    13.     ActiveWorkbook.Save
    14.     ActiveWorkbook.Close

    Thanks in advance,
    Brian
    Last edited by brianbaart; Nov 1st, 2004 at 11:04 AM.
    If Not Now Then When

    If Not Here Then Where

Posting Permissions

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



Click Here to Expand Forum to Full Width