View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Williams Trevor Williams is offline
external usenet poster
 
Posts: 181
Default Test for formula in cell

Hi Fred

Yes, * can be used as a wildcard but you need to change the '=' to 'Like'

If ActiveCell.Offset(0, -4).Formula Like " *" Then

HTH

Trevor Williams

"Fred Holmes" wrote:

Excel 2000

How do I get the following formula:

If ActiveCell.Offset(0, -4).Formula = " *" Then

to test if the formula/value (hard coded) in the cell is of the form

" ####"

(two spaces followed by four of any digits)?

Two spaces followed by anything would be good enough at present. The
above code produces false on " 1234" when I think it ought to produce
true. Is "*" usable as a wild card?

TIA

Fred Holmes