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 Replace sheet formulas with value

What would make you cells "active"

Set rng = Worksheets("Sheet1").Cells.Specialcells(xlFormulas )

would create a reference to cells that have formulas

if you formula returns a number then you could futher restrict it to

Set rng = Worksheets("Sheet1").Cells.SpecialCells(xlFomulas, xlNumbers)

or replace xlNumbers with xlTextValues

That at least narrows down the search.

for each cell in rng
if instr(cell.Formula,"myfunc") then
' one instance found
end if
Next

--
Regards,
Tom Ogilvy

"Conceptor" wrote in message
...
Hi,

I am trying to replace every sheet cells that contains a
occurence of a specific formula with its returned value.

If I would want to parse all cells that contains an
occurence of my formula, how could I do it (short of
parsing every single cells and doing a mid() to find out
if there is a formula inside or not)? Is there some
active cell collection Excel gives me access to or
something like that?

Thanks,
C.