Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to do a simple vlookup in Excel but getting an error when I step
through the process... Anyone know what's wrong? Public Sub SyncSheet2() Const ArtCol As String = "A" '<=== change to suit Dim i As Long Dim T As Long Dim FirstRow As Long Dim LastRow As Long Dim NextRow As Long Dim CellVal As Variant Dim DataCol As Variant Dim ArtNum As String Dim LookUpRng As Range Dim sh As Worksheet Set sh = Sheet2 With sh i = 1 Do Until FirstRow < 0 If IsNumeric(.Cells(i, "A")) Then If .Cells(i, "A").Value 0 Then FirstRow = i End If Else: FirstRow = 0 End If i = i + 1 Loop i = 1 Do Until LastRow < 0 If .Cells(i + 2, "A").Value = "" Then LastRow = i + 1 Else: LastRow = 0 i = i + 1 End If Loop End With With sh T = 2 For i = FirstRow To LastRow ArtNum = sh.Cells(i, ArtCol) CellVal = Application.VLookup(ArtNum, Sheet1.Range("A1:V306"), T, False) If IsError(CellVal) Then CellVal = "Error" End If With sh.Cells(i, "B") .Value = CellVal End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
error 2042 with vlookup | Excel Programming | |||
Error 2042 | Excel Programming | |||
vlookup error 2042 | Excel Programming | |||
Excel xlodbc error 2042 with SQLRetrieve | Excel Programming | |||
Error 2042 | Excel Programming |