Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searching for characters in a formula

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
I was writing a loop which would check to see if the active cell has the formula "=SUM(range)". I thought I would simply say something like

if activecell.value = "=*"

or

if activecell.value = "=SUM(*)"

but apparently I'm either using the wildcard wrong, or i have the wrong syntax, any ideas, thanks!
 
actually if you were to do a Ctrl+Find But by Formula, and search for "=", it would locate that formula in the cell, so maybe i should use formula or formulaR1C1 instead of value, but its still not working, can anyone tell me the difference between activecell.formula and activecell.formulaR1C1
 
Try this

If ActiveCell.Formula Like "=SUM*" Then

You have to use the Like feature for wildcards.

If you want to check for an =sum anywhere in the formula then do this

If ActiveCell.Formula Like "*=SUM*" Then

The * acts as a wildcard before and after the cell

Hope it helps

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top