Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Replace sheet formulas with value

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Replace sheet formulas with value

Another way an probably faster would be to use

Worksheets("Sheet1").Cells.Find(What:="MyFunc",Loo kin:=xlFormulas)

this sample form help shows how to search an entire sheet:

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Interior.Pattern = xlPatternGray50
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
-- 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Replace sheet formulas with value

Thanks again, tom.
C.
-----Original Message-----
Another way an probably faster would be to use

Worksheets("Sheet1").Cells.Find

(What:="MyFunc",Lookin:=xlFormulas)

this sample form help shows how to search an entire sheet:

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Interior.Pattern = xlPatternGray50
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <

firstAddress
End If
End With
-- 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.



.

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
Freeze Formulas - Replace Worksheet Gary''s Student Excel Discussion (Misc queries) 5 February 19th 10 02:16 PM
Replace data from sheet 2 into sheet 1 Thisnme Excel Discussion (Misc queries) 1 August 21st 09 02:52 AM
The 'Look in' box for the 'Replace...' has only the 'Formulas' GergD Excel Discussion (Misc queries) 1 July 19th 06 10:49 PM
Formula help! Find and replace in formulas Davin Excel Discussion (Misc queries) 7 December 22nd 05 08:48 PM
Search - replace NOT in formulas Michael Preminger Excel Worksheet Functions 1 February 18th 05 08:13 PM


All times are GMT +1. The time now is 01:15 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"