+ Reply to Thread
Results 1 to 3 of 3

using code variable to write cell formula

  1. #1
    rpw
    Guest

    using code variable to write cell formula

    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.

    --
    rpw

  2. #2
    Charlie
    Guest

    RE: using code variable to write cell formula

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

    need a space between the " and the &

    "rpw" wrote:

    > 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.
    >
    > --
    > rpw


  3. #3
    rpw
    Guest

    RE: using code variable to write cell formula

    Thanks Charlie!

    And also between the uf and the &.
    --
    rpw


    "Charlie" wrote:

    > "=if(d202>0,lookup(d202,'Materials & Multipliers'!$d5:$d" & uf & ",'Materials
    > & Multipliers'!$e5:$e" & uf & "),0)"
    >
    > need a space between the " and the &
    >
    > "rpw" wrote:
    >
    > > 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.
    > >
    > > --
    > > rpw


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1