'Problem with the proc not working properly. No _
syntax errors, just wrong results. puts "New Job" _
into all cells of colE. Chances are that some will be new, _
but most cells should be receiving an original _
invoice date.
'How this proc is supposed to work:
'looks at value in colA of Data3BDS sheet, sees if _
that value is in colA of AllSalesData sheet. If yes, it copies _
the original invoice date from AllSalesData and places it _
in the appropriate item row of colE of Data3BDS. If there is no matching value in colA of AllSalesData, then colE of Data3BDS is filled with "New Job".
Thanks.
syntax errors, just wrong results. puts "New Job" _
into all cells of colE. Chances are that some will be new, _
but most cells should be receiving an original _
invoice date.
'How this proc is supposed to work:
'looks at value in colA of Data3BDS sheet, sees if _
that value is in colA of AllSalesData sheet. If yes, it copies _
the original invoice date from AllSalesData and places it _
in the appropriate item row of colE of Data3BDS. If there is no matching value in colA of AllSalesData, then colE of Data3BDS is filled with "New Job".
Code:
Sub VLookupUseColA() 'looking for new item# or item# that _ is not replacing a different item#. pulling invoice date
Application.ScreenUpdating = False
Sheets("Data3BDS").Select 'sheet to receive the date info
Dim LastRow As Long
LastRow = Range("A65536").End(xlUp).Offset(1, 0).Row
With Range(activecell.Offset(0, 4).Address)
'The above line gives me address $E$2 as the activecell _
'"E" is the column to receive the original invoice date.
.Value = "=if(iserror(VLookup(activecell.offset(0,-4), AllSalesData!$A$2:$E$" & LastRow & ", 2, False)),""New Job"", VLookup(activecell.offset(0,-4), AllSalesData!$A$2:$E$" & LastRow & ", 2, False))"
'The above line puts "New Job" into all cells of colE _
instead of the original invoice date. But that is _ not 'correct. The item# being looked up is definitely _
in the "AllSalesData" table.
End With
Application.ScreenUpdating = True
End Sub
Thanks.