View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 'equals' for non-numeric data

the equal sign works for non-numeric data as well

if Range("A1").Value = Range("B9").value then

However, it has to be an exact match.

if lcase(Range("A1").Value) = lcase(Range("B9").value) then


You can use strcomp

if strcomp(Range("A1").Value,Range("b9").value,vbText Compare) = 0 then

the vbTextcompare says to use a case insensitive evaluation.

--
Regards,
Tom Ogilvy


"Josie" wrote:

Hi all

I'm very very new to this, so I'm writing a very simple macro. What I want
it to do is compare two cells and see if the contents are the same. The
contents are non numeric however.

Is there a 'is the same as' function or something?

Thanks, J