View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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?