Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting IF statement to a LOOP

Status
Not open for further replies.

SWmiller

MIS
Jul 23, 2001
54
US
Can someone give me assistance on how to convert the
following IF statements to one LOOP?

If Source = Range("C4") Then
Range("J4").Value = Date
End If

If Source = Range("C6") Then
Range("J6").Value = Date
End If

This is actually just part of the many IF statements that
abide to column C and J. The IF statements work fine, but
I know it would be more efficient to have to have one LOOP
instead of 50 IF statements. I just can't seem to get it
to work.

Thank you.
 
Do you know how far it needs to go?

for example if you have 50 rows

Step 2 will mean it goes 4,6,8,10,12,.... you get the picture.

For I = 4 to 50 step 2

If Source = Range("C" & I) Then
Range("J" & I).Value = Date
End If
next I


I think that will work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top