Computing.Net > Forums > Programming > IF and Next statement

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

IF and Next statement

Reply to Message Icon

Name: alienseiya
Date: February 12, 2009 at 04:36:04 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hi
I am buiding a form and Ive got this current lookup code to "rank" the observed values in column E:

Dim j As Integer
Argj1_2 = Array(0, CV1, CV1x2, CV1x3, CV1x4)
Argj2_2 = Array(0, CV2, CV2x2, CV2x3, CV2x4)
Argj3_2 = Array(0, CV3, CV3x2, CV3x3, CV3x4)
Argj4_2 = Array(0, CV4, CV4x2, CV4x3, CV4x4)
Argj5_2 = Array(0, CV5, CV5x2, CV5x3, CV5x4)
Argj6_2 = Array(0, CV6, CV6x2, CV6x3, CV6x4)
Argj_3 = Array(1, 2, 3, 4, 5)


For j = 5 To n + 4
If Cells(j, 6) = 1 Then
Cells(j, 7) = Application.WorksheetFunction.Lookup(Cells(j, 5), Argj1_2, Argj_3)
End If
If Cells(j, 6) = 2 Then
Cells(j, 7) = Application.WorksheetFunction.Lookup(Cells(j, 5), Argj2_2, Argj_3)
End If
If Cells(j, 6) = 3 Then
Cells(j, 7) = Application.WorksheetFunction.Lookup(Cells(j, 5), Argj3_2, Argj_3)
End If
If Cells(j, 6) = 4 Then
Cells(j, 7) = Application.WorksheetFunction.Lookup(Cells(j, 5), Argj4_2, Argj_3)
End If
If Cells(j, 6) = 5 Then
Cells(j, 7) = Application.WorksheetFunction.Lookup(Cells(j, 5), Argj5_2, Argj_3)
End If
If Cells(j, 6) = 6 Then
Cells(j, 7) = Application.WorksheetFunction.Lookup(Cells(j, 5), Argj6_2, Argj_3)
End If

Next j


The CV values in the arrays were previously defined in the script.

My issue is that I cant seem to make this script to provide me with the correct answers I am expecting to get. It returns a column of "1" in column E as opposed to either "1", "2", "3", "4" or "5".

Has anyone got an idea please?

Many thanks!



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


fetch data adobe reader not serching...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: IF and Next statement

Beginners help Pascal www.computing.net/answers/programming/beginners-help-pascal/6010.html

Excel Macro - sorting data www.computing.net/answers/programming/excel-macro-sorting-data/14285.html

New: Computer Advance Construct www.computing.net/answers/programming/new-computer-advance-construct/13584.html