• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Vlookup and fill in between two worksheets

Takecontrol

New Member
I work in the warranty department. I have one sheet that has defects and one sheet that has corrective actions. They both have a common identifying document number. I want to use Vlookup to pull the corrective action from the actions sheet and place them beside the same identifying document number on the defects sheet. I can get the first row in the defects sheet, but then have to drag the formula the rest of the way down the fill in the remaining rows of data. I would like to create a Macro to pull and fill in all the matching document numbers from the actions sheet to the defects sheet. The macro I have now only fills in the first row.

=VLOOKUP(K2,Actions!K2:M2476,3,FALSE)
 
I may have misunderstood, but what is the problem with using a formula?

=VLOOKUP(K2,Actions!$K$2:$M$2476,3,FALSE)

For a macro, I suppose you could do something like:

[pre]
Code:
Dim lastRow As Long
Dim myCol As String

'Find the last row
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

'Which column is formula going in?
myCol = "H"

'Input our formula to entire range
Range(Cells(2, myCol), Cells(lastRow, myCol)).Formula = _
"=VLOOKUP(K2,Actions!$K$2:$M$2476,3,FALSE)"
[/pre]
 
Back
Top