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?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?Please Login or Register to view this content.
Last edited by randell.graybill; 02-07-2010 at 01:04 AM.
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
I solved this by making sure the workbook that the sheets were moving to was the active workbook before trying to move the sheets.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks