View Full Version : whats wrong with this line of code


smiler44
09-02-2009, 07:19 AM
As title, whats wrong with this line of code?

If ActiveWorkbook.Name = "TLR_data_jp.xls" Or "TLR_data_jk.xls" Then


I have to sub's A and B. A runs, gets about half way through and then calls sub B. B runs and when it finishes sub A then continues.

For some reason A is running and calling sub B as it should. When B gets about half way through it reads the line of code
If ActiveWorkbook.Name = "TLR_data_jp.xls" Or "TLR_data_jk.xls" Then

and for some reason jumps back to routine A which carries on running.
so my question is, whats wrong with the line of code?
I'm using Excel 2007 but the TLR workbooks are 2003.

thank you in advance
smiler44

chergh
09-02-2009, 07:27 AM
it should be:


If ActiveWorkbook.Name = "TLR_data_jp.xls" Or _
ActiveWorkbook.Name = "TLR_data_jk.xls" Then

smiler44
09-03-2009, 09:56 AM
Brillient, thank you chergh.

Smiler44