Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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!

![]() |
fetch data
|
adobe reader not serching...
|

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