+ Reply to Thread
Results 1 to 3 of 3

Why are the sheets not moving?

  1. #1
    Forum Contributor
    Join Date
    04-03-2009
    Location
    USA, California
    MS-Off Ver
    Excel 2007
    Posts
    385

    Why are the sheets not moving?

    Please Login or Register  to view this content.
    both sheet names come up correctly when i check them via msgbox(dstwb) and msgbox(savewb). however when I try to move the sheets it gives me the subscript out of range error. what am I doing wrong?
    Last edited by randell.graybill; 02-07-2010 at 01:04 AM.

  2. #2
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Why are the sheets not moving?

    There is nothing wrong with the code. Just check if Array(1, 2) is returning you a positive integer less than the total number of sheets. I think that's where the 'Subscript out of range' error could result from.

    You can check the value it returns at that line by putting a stop at that line & checking in the Immediate Window by pressing Ctrl + G in the VB Editor. In the Immediate Window, type ?Array(1,2) and press Enter. See what you get.

    Regards,
    Karan

  3. #3
    Forum Contributor
    Join Date
    04-03-2009
    Location
    USA, California
    MS-Off Ver
    Excel 2007
    Posts
    385

    Re: Why are the sheets not moving?

    I solved this by making sure the workbook that the sheets were moving to was the active workbook before trying to move the sheets.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1