Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm having a problem trying to use a simple vlookup request and match it to
another variable. Two tables on two sheets. The problem I'm having is that when the vlookup request to the array comes back as an error when it shouldn't. I've looked at this code 100 times and I can't find an error. Any help?? Sheet1 501 Description A 502 Description B 503 Description C 504 Description D Sheet2 500 5/16/2011 TEST0 500 5/16/2011 TEST1 500 5/16/2011 TEST2 501 5/16/2011 TEST3 503 5/16/2011 TEST4 503 5/16/2011 TEST5 504 5/16/2011 TEST6 Here is my code: Sub KeepTrying() Sheets("Sheet2").Activate 'Get Count Range("A1").Select i = 0 Do Until ActiveCell.Value = "" ActiveCell.Offset(1, 0).Select i = i + 1 Loop 'Create Array using count Dim tableA() As Variant ReDim tableA(1 To i, 1 To 3) Range("A1").Select x = 1 Do Until x = i + 1 tableA(x, 1) = ActiveCell.Offset(0, 0).Value tableA(x, 2) = ActiveCell.Offset(0, 1).Value tableA(x, 2) = ActiveCell.Offset(0, 2).Value ActiveCell.Offset(1, 0).Select x = x + 1 Loop 'Check Sheets("Sheet1").Activate Range("A1").Select Do Until ActiveCell.Value = "" For d = 1 To i code = ActiveCell.Value codeCheck = Application.VLookup(d, tableA, 1, False) - PROBLEM!!! If code = codeCheck Then ActiveCell.Offset(0, 3).FormulaR1C1 = "Y" ActiveCell.Offset(1, 0).Select End If Next Loop End Sub ---------------- Chat Bot mIRC://bezerk.ath.cx |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Vlookup error in VBA, 2042 | Excel Programming | |||
error 2042 with vlookup | Excel Programming | |||
Error 2042 | Excel Programming | |||
vlookup error 2042 | Excel Programming | |||
Error 2042 | Excel Programming |