vlookup macro pasting

C

cbh35711

So i've got this forumla "=E3*VLOOKUP(D3,units,2,FALSE)"
I'm using a macro to fill a column in a sheet with that forumla, but I
need E3 and D3 to change as they would if i autofilled down. So they're
looking at the column in the same row as it is.
Any ideas?


Thanks,

Chris
 
T

Tom Ogilvy

this does what you want. Adjust to match your particulars.

Range("F3:F200").formula = "=E3*VLOOKUP(D3,units,2,FALSE)"
 
J

jordun

Hi
When using Vba, take advantage of cells(row,column) to do taks like
this.

I would suggest this code

Dim Ix as long, units as range

set range=sheets("???").range("????")

for Ix = [the first row in the range] to [last row in the range]
cells(Ix,??)=
cells(Ix,5)*worksheetfunction.vlookup(cells(Ix,4),units,2,0)
next Ix
 

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

Top