Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Nesting a formula in a macro

I have the following at the beginning of a macro:

R = Range("L1").Value

Is there a way to replace "L1" by the formula used in L1
itself.

Before excecuting the macro I put the following formula in
L1: =COUNT(I2:I100).

Basically, is it safe to directly replace ("L1") by its
formula?

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Nesting a formula in a macro

I'm confused: if COUNT(I2:I100) = 10, say, what would

R = Range("=COUNT(I2:I100)").Value

or

R = Range(10).Value

or

R = Range(Range("L1").Formula).Value

represent?

In article ,
"Richard" wrote:

I have the following at the beginning of a macro:

R = Range("L1").Value

Is there a way to replace "L1" by the formula used in L1
itself.

Before excecuting the macro I put the following formula in
L1: =COUNT(I2:I100).

Basically, is it safe to directly replace ("L1") by its
formula?

Thanks for any help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Nesting a formula in a macro

Richard,

I'm not sure exactly what you're after, however here are several examples of
what can be done.
Try them out, and see which one works best for you.

Range("L1").Formula = "=COUNT(I2:I100)"
Range("L1").Formula = "=COUNT($I$2:$I$100)"

Range("L1").FormulaR1C1 = "=COUNT(R[1]C[-3]:R[99]C[-3])"
Range("L1").FormulaR1C1 = "=COUNT(R2C9:R100C9)"

Range("L1").Value = Application.Count(Range("I2:I100")) ' Places the
value in L1


regards,

anon-e-mouse

I have the following at the beginning of a macro:

R = Range("L1").Value

Is there a way to replace "L1" by the formula used in L1
itself.

Before excecuting the macro I put the following formula in
L1: =COUNT(I2:I100).



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Nesting a formula in a macro

Richard,

Oh, one more thing:-

You can also do the do the following where "R" is a variable:-

R = Application.Count(Range("I2:I100"))

regards,

JohnI

I have the following at the beginning of a macro:

R = Range("L1").Value

Is there a way to replace "L1" by the formula used in L1
itself.

Before excecuting the macro I put the following formula in
L1: =COUNT(I2:I100).





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
Can you help nesting a formula? Da Bossman Excel Worksheet Functions 7 August 13th 07 10:00 AM
NESTING FORMULA Tonya Excel Worksheet Functions 1 August 29th 06 09:21 PM
Nesting Formula DSCAVOTTO Excel Discussion (Misc queries) 4 May 22nd 06 05:36 PM
Formula nesting BSantos Excel Worksheet Functions 6 January 19th 06 06:20 PM
nesting another formula BSantos Excel Worksheet Functions 3 January 18th 06 09:22 PM


All times are GMT +1. The time now is 06:38 PM.

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"