R1C1

S

stacia

Why won't this work?

Sub b9vlookup()
Dim theRange As Range
Dim lastrow&, firstRow&, x&
Set theRange = ActiveSheet.UsedRange
lastrow = theRange.Cells(theRange.Cells.Count).Row
firstRow = theRange.Cells(1).Row
For x = lastrow To firstRow Step -1
If InStr(1, Cells(x, 1), "Total") > 0 Then
Cells(x + 2).FormulaR1C1 = "=VLOOKUP(R[3]C,Address!R[-4]C:R[15]C[3],2)"


End If
Next
End Sub
 
J

Jim Thomlinson

Where is the formula supposed to land. In this part you indicate the row
index without a column index...

Cells(x + 2).
prehaps
Cells(x + 2, 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

end it 2
automatic page break 1
HELP Copy And Paste 7
Need Excel Macro to Find Specific Text and Characters 1
Creating a fixture list 3
Delete duplicates? 2
Save details 2
macro filter 4

Top