ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vlookup ? (https://www.excelbanter.com/excel-programming/402812-vlookup.html)

lee willis[_2_]

vlookup ?
 
I need to know how to do a vlookup and then pull all the data under it in the
field that is the same as the lookup. ie i am looking up ford and in the
lookup range there is more than 1 ford in a row? so lookup range is
sheet1a2:ac1040. ford is in cells a407 thur a597. i need to pull a407 thur
ac407 in row 1 of sheet2 i know the formula for that what i am having a hard
time with is row2 of sheet 2 needs to be filled with a408 thur ac408. can
some one help me with this?

joel

vlookup ?
 
Your description isn't very clear. The code below "may" work, but if not use
it as a model or be a little clearer what you are looking for.

Sub findford()
Set Lookuprange = Sheets("Sheet1").Range("a2:a1040")

Sh2RowCount = 1
For Each cell In Lookuprange
If cell = "ford" Then
With Sheets("Sheet1")
.Range(.Cells(cell.Row, "A"), _
.Cells(cell.Row, "AC")).Copy _
Destination:= _
Sheets("Sheet2").Cells(Sh2RowCount, "A")
Sh2RowCount = Sh2RowCount + 1
End With
End If
Next cell


End Sub


"lee willis" wrote:

I need to know how to do a vlookup and then pull all the data under it in the
field that is the same as the lookup. ie i am looking up ford and in the
lookup range there is more than 1 ford in a row? so lookup range is
sheet1a2:ac1040. ford is in cells a407 thur a597. i need to pull a407 thur
ac407 in row 1 of sheet2 i know the formula for that what i am having a hard
time with is row2 of sheet 2 needs to be filled with a408 thur ac408. can
some one help me with this?



All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com