Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VLookUp problem 3

Status
Not open for further replies.

stillwillyboy

Technical User
Jan 22, 2004
165
US
When I try to execute (step thru with F8) the following code, I get an error message “Run time error 1004, Application defined or Object defined error.” at the .Value line.

Sub VLookUpCopiedPieceRate()
Application.ScreenUpdating = False

Dim LastRow As Range
Set LastRow = Range("A65536").End(xlUp)

With Range("B1") 'B1 is for PieceRate on the active _sheet. It receives the rate from the Jobs sheet
.Value = "=VLOOKUP(A1, Jobs!$A$1:$F$" & LastRow & ", 2, FALSE)"
.AutoFill Destination:=Range(Cells(.Row, .Column), Cells(Cells(2, 1).End(xlDown).Row, .Column)), Type:=xlFillDefault

End With

End Sub

“Jobs” is the worksheet with the info I want to pull. I have verified the sheet name. Col A of Jobs has the job numbers, sorted. Col B has the piece rate that I want to move to the active sheet.

Col A of the active sheet has the job numbers, sorted. Col B of the active sheet is blank.

Whenever I hover the mouse over the LastRow variable in break mode, the row count is 85340412.

This should be working.

TIA

Bill
 
Dim LastRow As [!]Long[/!]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

That causes an Object Required error with LastRow in the Set statement highlighted.

Bill
 
OOps, incomplete reply, sorry:
Dim LastRow As [!]Long[/!]
[!]Set [/!]LastRow = Range("A65536").End(xlUp).Row

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Just wanted to say thanks for the help. You guys were giving me the answer and I just didn't see it.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top