# Thread: IF OR AND not work!!!! (2000 sr -1)

1. ## IF OR AND not work!!!! (2000 sr -1)

If Sheets("L0953").Range("Q" + RIGA) = "S" Or Sheets("L0953").Range("S" + RIGA) = "C" And Sheets("L0953").Range("D" + RIGA) = MODIFICHE_USER.ComboBox1.Value And Sheets("L0953").Range("L" + RIGA) = MODIFICHE_USER.ComboBox2.Value Then

riga = 3
MODIFICHE_USER.ComboBox1.Value =146900090000
MODIFICHE_USER.ComboBox2.Value =4500

in this sheet the condition existis but not work!!!!

2. ## Re: IF OR AND not work!!!! (2000 sr -1)

This?

If (Sheets("L0953").Range("Q" & RIGA) = "S" Or Sheets("L0953").Range("S" & RIGA) = "C") And Sheets("L0953").Range("D" & RIGA) = MODIFICHE_USER.ComboBox1.Value And Sheets("L0953").Range("L" & RIGA) = MODIFICHE_USER.ComboBox2.Value Then

3. ## Re: IF OR AND not work!!!! (2000 sr -1)

Sorry but not intercept in other case??????

4. ## Re: IF OR AND not work!!!! (2000 sr -1)

Then you'll have to tell us exactly and clearly what you want to test for.

5. ## Re: IF OR AND not work!!!! (2000 sr -1)

In column D and in column L first condition...
and if exitis one of this condition ("S" or "C") in column Q or column column S

6. ## Re: IF OR AND not work!!!! (2000 sr -1)

The values of the combo boxes and of column D are text strings, but the value of column L is a number. Try

If (Sheets("L0953").Range("Q" & RIGA) = "S" Or Sheets("L0953").Range("S" & RIGA) = "C") And Sheets("L0953").Range("D" & RIGA) = MODIFICHE_USER.ComboBox1.Value And Sheets("L0953").Range("L" & RIGA) = CLng(MODIFICHE_USER.ComboBox2.Value) Then

CLng converts the text string to a number.

7. ## Re: IF OR AND not work!!!! (2000 sr -1)

Sorry me, i am stupid!
Work now, as usual!
Tks.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•