Question Is It Possible To Make Copy of Sheet Within Same Workbook?

kstoneman10

Member
Joined
Feb 20, 2010
Messages
11
Programming Experience
3-5
I have a worksheet that I use as a template within in a workbook that I make copies of and then rename them. Here is the code I am using without success:

HTML:
exlwb3.Worksheets("FA1").Copy(Before:=exlwb3.Worksheets("Combined"))

Right now I am getting this error, "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"

Any help is greatly appreciated.
 
The code is valid, verify the sheet names (not case sensitive).
 
That is possible. Perhaps you should try the code when the sheet is not hidden also?
 
I do believe if the file is hidden, has an impact on what VB does with it. If it is hidden, it recognizes it as not there. So therefor; it will give you that error.
 
Back
Top