D
Derek
I have a piece of code that someone else has written.
There is a line of code that opens another workbook
(wkBk2):
Workbooks.Open FileName:=(wkBk2)
The program does open the new workbook. The next line of
code causes a crash (Run-Time error 9):
Sheets("April").Activate
The problem arises because the "April" worksheet is NOT in
the ActiveWorkbook. It is, however, in the newly opened
workbook (wkBk2). I would expect the newly opened wkBk2
to be the active workbook (since it was just opened), but
it is not. Apparently, this program has been up and
running for over a year. Now, however, this piece of code
is causing it to crash. I would appreciate some help in
understanding why this could all of a sudden stop
running. TIA...
There is a line of code that opens another workbook
(wkBk2):
Workbooks.Open FileName:=(wkBk2)
The program does open the new workbook. The next line of
code causes a crash (Run-Time error 9):
Sheets("April").Activate
The problem arises because the "April" worksheet is NOT in
the ActiveWorkbook. It is, however, in the newly opened
workbook (wkBk2). I would expect the newly opened wkBk2
to be the active workbook (since it was just opened), but
it is not. Apparently, this program has been up and
running for over a year. Now, however, this piece of code
is causing it to crash. I would appreciate some help in
understanding why this could all of a sudden stop
running. TIA...