View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Save Cell Properties into an Array

Personally I would use specialcells like Norman Suggested. So it wouldn't
be a consideration.


Activesheet.UsedRange.SpecialCells(xlFormulas).Int erior.ColorIndex = 3

as an example.

Still the array approach is useful for other things and I have used it
before. However, not for properties that I am aware of.

To save you some time, v = Range("A1:F10").Text

doesn't work. V holds NULL

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in
message ...
This must be why they pay you the big money... I never even thought to do
that. As a guess though how much faster would it be than just looping

through
the range and adding a format as the OP requested. Lots? A little? Not

much
if any?
--
HTH...

Jim Thomlinson


"Tom Ogilvy" wrote:

You can read the formula into an array, but not any properties.

You can then check each item for a leading =

constants will also be read into the array.


v = Range("A1:F30").Formula

from the immediate window:

v = Range("A1:F30").Formula
? v(1,1)
=TRUNC(RAND()*100+1)
? v(1,2)
49


--
Regards,
Tom Ogilvy


wrote in message
oups.com...
I often read and write chunks of Excel data by reading them into a
variant array, process the data, and then write the changes back. As
most know this is a very effecient method.

I would like to do the same think with a range of cell properties.

For
example I would like to be able to individually check which cells on a
sheet contain a formula. I am currently reading the cells into a

range
object and looping through each cell in the range. The ones with a
formula I am applying a special format.

Is it possible to read the .HasFormula property into a variant array
and loop through the array instead of through the range. I think it
might be faster but cannot get it to work.

Any help or direction is appreciated.
Thanks
Darryl Smith