ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Several AND operators inside an IF... (https://www.excelbanter.com/excel-programming/423423-several-operators-inside-if.html)

SpeeD

Several AND operators inside an IF...
 
Hi guys.

I have the folowing problem. i need to check 3 conditons inside an IF to
make may macro work. The problem is that it only work with 1 AND not 2 inside
the IF...

Can anyone help me?

This works...
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False Then GoTo 1

This doesn´t work!!!
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False And Sheets("Original 3").Visible = False Then GoTo 1



Luke M

Several AND operators inside an IF...
 
It'll work, its just a syntax error. Try inputting the command as a single
line of code, watching our for erroneous spaces.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"SpeeD" wrote:

Hi guys.

I have the folowing problem. i need to check 3 conditons inside an IF to
make may macro work. The problem is that it only work with 1 AND not 2 inside
the IF...

Can anyone help me?

This works...
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False Then GoTo 1

This doesn´t work!!!
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False And Sheets("Original 3").Visible = False Then GoTo 1



SpeeD

Several AND operators inside an IF...
 
Hi Luke.

The code is this in just one line (the post broke it...)
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False And Sheets("Original 3 ").Visible = False Then GoTo 1

And it simply doens´t work. When i put tjhe second AND in the code doens´t
run.

SpeeD

"Luke M" wrote:

It'll work, its just a syntax error. Try inputting the command as a single
line of code, watching our for erroneous spaces.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"SpeeD" wrote:

Hi guys.

I have the folowing problem. i need to check 3 conditons inside an IF to
make may macro work. The problem is that it only work with 1 AND not 2 inside
the IF...

Can anyone help me?

This works...
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False Then GoTo 1

This doesn´t work!!!
If Sheets("Original 1").Visible = False And Sheets("Original 2").Visible =
False And Sheets("Original 3").Visible = False Then GoTo 1




All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com