Help with an If statement VBA

  • Thread starter Thread starter SOS
  • Start date Start date
S

SOS

Hi all,

In my spreadsheet i want to populate a cell with a value dependent o
the result of two other cells and I would like some help with the vb
line to do this.


I know it can be written as follows in 3 lines of code:

If Range("A1").Value = "Referee" AND Range("B1").Value = "U21" The
Range("G23").Value = "Value 1"
If Range("A1").Value = "Referee" AND Range("B1").Value = "U19" The
Range("G23").Value = "Value 1"
If Range("A1").Value = "Referee" AND Range("B1").Value = "U17" The
Range("G23").Value = "Value 1"

but really what I want is to evaluate with one line of code to say i
A1 = "Referee" AND B1 is any of "U21", "U19", "U17" then G23
"Value1"

Hope I have made myself clear enough and any help would b
appreciated.

TIA

Seamu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top