using code variable to write cell formula

R

rpw

Hi all,

The following gets a compile error expected:end of statement and the second
set of quotation marks are highligted.

uf = cellb.Row
Worksheets("Basic Pricing").Range("F202").Formula =
"=if(d202>0,lookup(d202,'Materials & Multipliers'!$d5:$d"& uf & ",'Materials
& Multipliers'!$e5:$e"& uf & "),0)"

I've tried building the string step by step with (a variable uf) but the
cell formula doesn't update.

Worksheets("Basic Pricing").Range("F202").Formula = uf

Help with either or both would be much appreciated.
 
C

Charlie

"=if(d202>0,lookup(d202,'Materials & Multipliers'!$d5:$d" & uf & ",'Materials
& Multipliers'!$e5:$e" & uf & "),0)"

need a space between the " and the &
 

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