Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RPW RPW is offline
external usenet poster
 
Posts: 52
Default 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(d2020,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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default using code variable to write cell formula

"=if(d2020,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(d2020,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   Report Post  
Posted to microsoft.public.excel.programming
RPW RPW is offline
external usenet poster
 
Posts: 52
Default using code variable to write cell formula

Thanks Charlie!

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


"Charlie" wrote:

"=if(d2020,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(d2020,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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write formula with code ... Sige Excel Programming 12 February 6th 06 07:23 PM
Code to copy formula to variable range Snowsride Excel Programming 4 November 3rd 05 09:41 PM
Variable cell in vba code Mikeice[_30_] Excel Programming 2 July 30th 05 11:40 AM
How do I write a formula to color code based on dates provided or. jaime Excel Worksheet Functions 2 February 17th 05 12:41 AM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"