L
Legacy 433589
Guest
Hey everyone!
I have a workbook that keeps throwing the title error when attempting to copy a worksheet from one workbook to another. This error is so common that, in order to make sure I got it right in the thread title, I used Google's autocomplete. But whenever I look it up, the resolutions always refer to a workbook trying to copy a worksheet back into itself multiple times. There's no mention of any other error mode, and none of the items I can find on it seem to express a solid understanding of what is actually happening to trigger this error.
My workbook has many hidden sheets, many locked sheets and two routines for development that will unhide/unlock everything, and hide/lock it back up for releasing to the user base. (It's a really big piece of sausage...) I mention this because when unlocked/unhidden the code works fine - it only throws the error when it's all locked up and some of the articles do mention hidden objects as a potential source of the problem.
This is a re-type from my other pc screen rather than a copy and paste, but the snippet of code it errors on is:
If the formatting holds, the bold line is where it errors (the copy line, of course).
If anyone has any ideas for a solution or even a bad workaround, I would very much appreciate it! If more information is required, I stand ready to respond.
I have a workbook that keeps throwing the title error when attempting to copy a worksheet from one workbook to another. This error is so common that, in order to make sure I got it right in the thread title, I used Google's autocomplete. But whenever I look it up, the resolutions always refer to a workbook trying to copy a worksheet back into itself multiple times. There's no mention of any other error mode, and none of the items I can find on it seem to express a solid understanding of what is actually happening to trigger this error.
My workbook has many hidden sheets, many locked sheets and two routines for development that will unhide/unlock everything, and hide/lock it back up for releasing to the user base. (It's a really big piece of sausage...) I mention this because when unlocked/unhidden the code works fine - it only throws the error when it's all locked up and some of the articles do mention hidden objects as a potential source of the problem.
This is a re-type from my other pc screen rather than a copy and paste, but the snippet of code it errors on is:
Code:
Workbooks(JCWID).Activate
sheetcount = ActiveWorkbook.Worksheets.count
If sheetcount > 42 Then
For x = 43 to sheetcount
[B]Workbooks(JCWID).Sheets(x).Copy After:=Workbooks(FileID).Sheets(Workbooks(FileID).Sheets.count)[/B]
Next x
End If
If the formatting holds, the bold line is where it errors (the copy line, of course).
If anyone has any ideas for a solution or even a bad workaround, I would very much appreciate it! If more information is required, I stand ready to respond.