Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default HELP: Search a formula inside of a Cell

I am trying to compare some old spreadsheets and upgrade to the new and have
a case in try to determine if a value was added to a formula inside a cell.
So I would like to do a search/find on the contents of the FORMULA in the
cell.

Example: Cell A1 Contains a formula +F12+F34+F67

Is there a function that can search the formula? Example: FIND "F34" in
cell A1. Everything I can see so far you can only search the results, not
the formula.

Thank you in advance for your help!!!
Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 9,101
Default HELP: Search a formula inside of a Cell

formula are strings. Usually I use the FIND in the worksheet menu to locate
the formula instead of writing VBA code. You can use for if necessary

mystring = Range("A1").formula
if Instr(mystring,"F34") 0 then
'enter your code here
end if



"Michael Kintner" wrote:

I am trying to compare some old spreadsheets and upgrade to the new and have
a case in try to determine if a value was added to a formula inside a cell.
So I would like to do a search/find on the contents of the FORMULA in the
cell.

Example: Cell A1 Contains a formula +F12+F34+F67

Is there a function that can search the formula? Example: FIND "F34" in
cell A1. Everything I can see so far you can only search the results, not
the formula.

Thank you in advance for your help!!!
Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 11,058
Default HELP: Search a formula inside of a Cell

From the Macro Recorder:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 1/14/2008 by James Ravenswood
'

'
Cells.Find(What:="F34", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
End Sub

--
Gary''s Student - gsnu2007c


"Michael Kintner" wrote:

I am trying to compare some old spreadsheets and upgrade to the new and have
a case in try to determine if a value was added to a formula inside a cell.
So I would like to do a search/find on the contents of the FORMULA in the
cell.

Example: Cell A1 Contains a formula +F12+F34+F67

Is there a function that can search the formula? Example: FIND "F34" in
cell A1. Everything I can see so far you can only search the results, not
the formula.

Thank you in advance for your help!!!
Mike



  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 11,501
Default HELP: Search a formula inside of a Cell

Michael,

Not sure how it could be done at worksheet level but here's a macro

Sub searchFormula()
Dim MyRange As Range
Set MyRange = Range("A1:B20")
For Each c In MyRange
If c.HasFormula Then
If InStr(1, c.Formula, "F34", vbTextCompare) 0 Then
MsgBox "Formula at " & c.Address & " contains F34 "
End If
End If
Next


I think I'd prefer to make the search address a variable but that should be
an easy conversion.


Mike

"Michael Kintner" wrote:

I am trying to compare some old spreadsheets and upgrade to the new and have
a case in try to determine if a value was added to a formula inside a cell.
So I would like to do a search/find on the contents of the FORMULA in the
cell.

Example: Cell A1 Contains a formula +F12+F34+F67

Is there a function that can search the formula? Example: FIND "F34" in
cell A1. Everything I can see so far you can only search the results, not
the formula.

Thank you in advance for your help!!!
Mike



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
Search data inside column SANTANDER Excel Programming 3 October 25th 07 03:45 PM
Utilizing a Cell even with a Formula located inside it Ahh, Excel's Tough Excel Worksheet Functions 4 July 3rd 07 01:13 AM
using the name of a worksheet written in a cell, inside a formula Using the name of a worksheet written in Excel Worksheet Functions 2 March 6th 06 10:29 PM
Using a value from a cell inside a formula! marsupilami Excel Discussion (Misc queries) 5 August 24th 05 07:06 AM
Apparently Empty Cell--with formula inside foamfollower Excel Programming 1 March 4th 04 07:35 AM


All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"