View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sylink sylink is offline
external usenet poster
 
Posts: 30
Default Need help to convert formula

Am new into vba. I have this task which is a little difficult for me. i
need to translate this excel formula into program:
=IF(C2="FSOP","P","S").

Iwas on column "I". and developing a macro for an undetermined no of
rows, i got this but couldn't achieve the objective.



Dim z As Integer
Dim str As String
Dim tt As String
Dim cy As String
str = "A1"
Range(str).Select
z = 2

Do While str < " "
cy = "C" & z
Range(cy).Select

If cy = "FSOP" Then
tt = "i" & z
Range(tt).Select
tt = "P"
z = z + 1
str = "A" & z
Else
tt = "i" & z
Range(tt).Select
tt = "S"
str = "A" & z
z = z + 1
End If
Loop