stillwillyboy
Technical User
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
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