Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Range Reference
The following code doesn't work with a Method Range of object Global failed
error For b = 6 To 15 Set rng = Range(Cells(3, b)) rng.Select Selection.FormulaArray = "=PERCENTILE(R52C4:R" & c & "C4,R2C" & b & ")" Next But if I hard code the destination cell i.e. Set rng = Range("f3") it will work for that one cell. What am I doing wrong in naming this range? Any help is greatly appreciated. Also, is there an On Exit event for a cell? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Range Reference
Set rng = Range(Cells(3, b))
should be Set rng = Cells(3, b) -- Regards, Tom Ogilvy "Bob" wrote in message ... The following code doesn't work with a Method Range of object Global failed error For b = 6 To 15 Set rng = Range(Cells(3, b)) rng.Select Selection.FormulaArray = "=PERCENTILE(R52C4:R" & c & "C4,R2C" & b & ")" Next But if I hard code the destination cell i.e. Set rng = Range("f3") it will work for that one cell. What am I doing wrong in naming this range? Any help is greatly appreciated. Also, is there an On Exit event for a cell? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Range Reference
Try:
For b = 6 to 15 Set rng = Cells(3,b) rng.FormulaArray = "=PERCENTILE(R52C4:R" & c & "C4,R2C" & b & ")" Next b Ray at work "Bob" wrote in message ... The following code doesn't work with a Method Range of object Global failed error For b = 6 To 15 Set rng = Range(Cells(3, b)) rng.Select Selection.FormulaArray = "=PERCENTILE(R52C4:R" & c & "C4,R2C" & b & ")" Next But if I hard code the destination cell i.e. Set rng = Range("f3") it will work for that one cell. What am I doing wrong in naming this range? Any help is greatly appreciated. Also, is there an On Exit event for a cell? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Range Reference
Of course, thanks.
"Tom Ogilvy" wrote: Set rng = Range(Cells(3, b)) should be Set rng = Cells(3, b) -- Regards, Tom Ogilvy "Bob" wrote in message ... The following code doesn't work with a Method Range of object Global failed error For b = 6 To 15 Set rng = Range(Cells(3, b)) rng.Select Selection.FormulaArray = "=PERCENTILE(R52C4:R" & c & "C4,R2C" & b & ")" Next But if I hard code the destination cell i.e. Set rng = Range("f3") it will work for that one cell. What am I doing wrong in naming this range? Any help is greatly appreciated. Also, is there an On Exit event for a cell? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to reference variable range? | Excel Discussion (Misc queries) | |||
Variable Cell Range Reference | Excel Worksheet Functions | |||
VLOOKUP variable range cell reference | Excel Worksheet Functions | |||
Variable range reference | Excel Discussion (Misc queries) | |||
A function to get a variable row reference for range in XNPV funct | Excel Worksheet Functions |