View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Expressing If formula in VBA

you can have 7 nested if statements - you only have 2, so there is no reason
not to use your formula.

in VBA, however
if instr(1,Range("A121"), _
"18-00 Seven News SEVEN Brisbane",vbTextcompare) then
v = 200
elseif instr(1,Range("A121"), _
"18-00 Seven News SEVEN Sydney",vbTextcompare) Then
v = 300
else
v = 0
End if


--
Regards,
Tom Ogilvy


"Vlad999" wrote in
message ...

Hi I have a really long if formula and excel limits the number of if
formulas you can use in any one cell. So if someone would help me out
and show me how to convert this into VBA then I could add in the rest
of the formulas my self.

=IF(COUNTIF(A121,"*18-00 Seven News SEVEN
Brisbane*")*1,200,IF(COUNTIF(A121,"*18-00 Seven News SEVEN
Sydney*")*1,300,0))

Thanks.


--
Vlad999
------------------------------------------------------------------------
Vlad999's Profile:

http://www.excelforum.com/member.php...o&userid=33586
View this thread: http://www.excelforum.com/showthread...hreadid=544111