View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SOS[_32_] SOS[_32_] is offline
external usenet poster
 
Posts: 1
Default Help with an If statement VBA


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

--
SO
-----------------------------------------------------------------------
SOS's Profile: http://www.excelforum.com/member.php...nfo&userid=540
View this thread: http://www.excelforum.com/showthread.php?threadid=26156