Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim Counter as Long
for counter = 0 to Sheet3.Range("U65000").End(XLUp).Row - 2 ''all your code here next counter works for all rows where there is a value in U add offset to all your range refernces ie...Sheet3.Range("L2").Offset(counter,0).Value = grade "oscarooko" wrote: Hello, I need a loop for my code. I have this code, but it will only check if the conditions are true for the first row, assigns a grade for teh row, and then it terminates. I need it to go through all rows irrespective of "how many" they are. Someone help! Sub Oscar() Dim grade As String Dim FICO As String Dim Lien As String Dim LTV As String Dim DTI As String FICO = Sheet3.Range("U2").Value Lien = Sheet3.Range("AA2").Value LTV = Sheet3.Range("S2").Value DTI = Sheet3.Range("V2").Value If (FICO 700 And Lien = 1 And LTV < 90 And DTI <= 45) Or (FICO 720 And Lien = 1 And LTV < 95 And DTI <= 45) Then grade = "Prime" Else If (FICO 650 And Lien = 1 And LTV < 95 And DTI <= 45) Or (FICO = 680 And Lien = 1 And LTV < 95 And DTI <= 50) Or (FICO = 680 And Lien = 2 And LTV < 95 And DTI <= 50) Then grade = "AA" Else If (FICO = 600 And Lien = 1 And LTV < 100 And DTI <= 50) Or (FICO = 620 And Lien = 2 And LTV <= 95 And DTI <= 45) Then grade = "A+" Else: grade = "FAIL" End If End If End If Sheet3.Range("L2").Value = grade End Sub -- oscarooko ------------------------------------------------------------------------ oscarooko's Profile: http://www.excelforum.com/member.php...o&userid=28116 View this thread: http://www.excelforum.com/showthread...hreadid=477183 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find loop doesn't loop | Excel Discussion (Misc queries) | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Loop Function unable to loop | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming |