PDA

View Full Version : Looking up data in a price file



Klartigue
10-17-2011, 11:23 AM
I have data laid out in an excel table. In column B, there is either an "S" or "B" in each cell. I would like to write a macro that selects only the rows with an "S" in column B. I am unfamiliar with how macros work when an excel table is invovled.

Any help is greatly appreciated.

Thanks!

Aussiebear
10-18-2011, 02:42 AM
"Solved"...... How? Since no solution has been provided by others, can I assume you finally realised that Excel's Filter function does exactly what you asked for.

As someone posting a thread in a public forum, could you please supply the "solution", then mark it as Solved, rather than just hide behind the options provided by the forum.

Klartigue
10-19-2011, 02:53 PM
Sub EvalPriceLookup()
'
' Look up eval price
'
Windows("Volume.xlsx").Activate

With ActiveSheet

LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 2 To LastRow

If .Cells(i, "B") <> "B" Then

.Cells(i, "J").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-4],pricefile.xlsx!R1:R1048576,2,FALSE)"

End If
Next i
End With

Aussiebear
10-20-2011, 12:48 AM
Thankyou

mdmackillop
10-20-2011, 05:28 AM
Get rid of the Select
.Cells(i, "J").FormulaR1C1 = "=VLOOKUP(RC[-4],pricefile.xlsx!R1:R1048576,2,FALSE)"