Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Syntax using variable in cell Formula

I want to use a variable in a cell formula like this:
Dim myrng

myrng = Worksheets("Synopsis").Range("A" & Counter + 2)
Range("D1:D" & RowCount - 1).Formula =
"=IF(AND(Totals!$F$1-Data!B1<7,A1=A2,myrng),1,0)"

Because of the " " around the formula, the value of myrng does not appear,
only the word.

TIA, Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax using variable in cell Formula

myrng = Worksheets("Synopsis").Range("A" & Counter + 2).Value
Range("D1:D" & RowCount - 1).Formula = _
"=IF(AND(Totals!$F$1-Data!B1<7,A1=A2," & myrng & "),1,0)"



--
Regards,
tom Ogilvy



Mike Fogleman wrote in message
...
I want to use a variable in a cell formula like this:
Dim myrng

myrng = Worksheets("Synopsis").Range("A" & Counter + 2)
Range("D1:D" & RowCount - 1).Formula =
"=IF(AND(Totals!$F$1-Data!B1<7,A1=A2,myrng),1,0)"

Because of the " " around the formula, the value of myrng does not appear,
only the word.

TIA, Mike




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Syntax using variable in cell Formula

Thanks for the very fast response, Tom. I must have lost that second
ampersand while I was beating around the bush.
"Tom Ogilvy" wrote in message
...
myrng = Worksheets("Synopsis").Range("A" & Counter + 2).Value
Range("D1:D" & RowCount - 1).Formula = _
"=IF(AND(Totals!$F$1-Data!B1<7,A1=A2," & myrng & "),1,0)"



--
Regards,
tom Ogilvy



Mike Fogleman wrote in message
...
I want to use a variable in a cell formula like this:
Dim myrng

myrng = Worksheets("Synopsis").Range("A" & Counter + 2)
Range("D1:D" & RowCount - 1).Formula =
"=IF(AND(Totals!$F$1-Data!B1<7,A1=A2,myrng),1,0)"

Because of the " " around the formula, the value of myrng does not

appear,
only the word.

TIA, Mike






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
SaveAs syntax when using a variable Keith Excel Programming 3 November 4th 03 05:48 PM
Syntax for variable search Tom Ogilvy Excel Programming 3 August 6th 03 06:16 PM
Syntax for variable search brym Excel Programming 0 August 6th 03 05:41 PM
Syntax for variable search brym Excel Programming 2 August 6th 03 05:32 PM
Syntax for variable search Don Guillett[_4_] Excel Programming 0 August 6th 03 04:35 PM


All times are GMT +1. The time now is 11:24 AM.

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

About Us

"It's about Microsoft Excel"