View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Converting IF Formul To VBA

Why do you want to change it to VBA?

When you say apply it to B3:B102, how does each of those cells relate to
that formula. For example, if that formula is in B3, the formula in B4 would
be

IF((AND(S53,V50,U5="A3")),"A1",(IF((OR(W5<AM5,$A E$3<12,AA59)),"a1",IF((AN
D(S510,AA51)),"A1",IF(S53,"A2","")))))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"LoveCandle" wrote
in message ...

Hi everybody,

I have this IF Formula and I want to convert it to VBA code to get the
same purpose,



Code:
--------------------

IF((AND(S43,V40,U4="A3")),"A1",(IF((OR(W4<AM4,$A E$3<12,AA49)),"a1",IF((AN
D(S410,AA41)),"A1",IF(S43,"A2","")))))
--------------------


Actually, I tried this code but it didn't work properly with me I
don't know the error exactly.


Code:
--------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If (Range("S" & Target.Row).Value 3 And Range("V" & Target.Row).Value
0 And Range("U" & Target.Row).Value = "A3") _
Or (Range("W" & Target.Row).Value < Range("AM" & Target.Row).Value Or

Range("AE" & Target.Row).Value < 12 Or Range("AA" & Target.Row).Value 9) _
Or (Range("S" & Target.Row).Value 10 And Range("AA" &

Target.Row).Value 1) Then
Range("B" & Target.Row).Value = "A1"
ElseIf Range("S" & Target.Row).Value 3 Then
Range("B" & Target.Row).Value = "A2"
Else: Range("B" & Target.Row).Value = ""
Exit Sub
End If
End Sub
--------------------


So, I would like you please to help me to get the formuls working in
range B3:B102 only.

Thanks for all.


--
LoveCandle
------------------------------------------------------------------------
LoveCandle's Profile:

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