Split Workbook part 2
the code I wrote was
On Error Resume Next
Set bk = Workbooks(sCheryl)
On Error GoTo 0
If that is the code you are using, you need to go to the VBE and in
tools=Options , General Tab make sure have have
Break on Unhandled Errors
checked.
In the code I wrote, at the top it has
Application.DisplayAlerts = False
with this in effect, you would not get the prompt that the file already
exists.
the bk variable is to determine if the workbook exists and if it is open or
not. Since you would have multiple worksheets being placed in the same
workbook, after the first time it is created, it should still be open and
then only the sheet needs to be copied to the existing workbook.
--
Regards,
Tom Ogilvy
"Cheryl" wrote in message
...
Tom: thanks for the code. It's generating some errors in
that
Set bk = Workbooks(sCheryl) always says subscript out of
range and
ActiveWorkbook.SaveAs Filename:= ThisWorkbook.Path & "\" &
sCheryl & ".xls" says filename already exists, chose
another name or close the existing workbook when it tries
to create a workbook that already exists.
If bk Is Nothing Then is always equating to Nothing so I
believe that is why I'm getting the above error message.
Thu I understand what the code is doing as it involves
arrays and Collections it is a bit above my abilities.
I've spent the better part of the last couple of days
attempting changes but no luck... any help would be
appreciated.
|