#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Loop

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Loop Function unable to loop Junior728 Excel Programming 1 July 28th 05 10:23 AM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"