I need to loop trough 20 rows and add an equation to a worksheet that differs by variables. I'm using a If.... Else If statement, and I think I need to declare variable as I am only populating the second row of data.
My Code:
Do While counter < 20
counter = counter + 1
If CNum = 269 And SCode = 7168 Then
NTotal = ("=(C2*35)/1000")
Range("E2").Value = NTotal
ElseIf CNum = 269 And SCode = 7181 Then
NTotal = ("=(C2*2.5)/1000")
Range("E2").Value = NTotal
ElseIf CNum = 269 And SCode = 7183 Then
NTotal = ("=(2*(D2-C2))/1000+50")
Range("E2").Value = NTotal
End If
Loop
Do I simply declare a range value for C2, D2, and E2 to make this work?
Joe