View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Case Sensitive w/ IF

You can tell excel to ignore case in text comparisons for that module.

Just put that "option compare text" at the top of the module.

Put it at the top of a test module.
select Option and hit F1. You'll see VBA's help for all the Option options.

jeffP wrote:

Thanks to all for the quick and good answers.
Always interested in learing so Dave could you explain further the Option
Compare Text?

thanks again

"Dave Peterson" wrote:

One way:
if lcase(activecell.text)="yes" then

Another:
if strcomp(activecell.text, "yes", vbtextcompare) = 0 then

or put
Option Compare Text
at the top of the module


jeffP wrote:

All I'm trying to do is check a cell for a text answer:

If ActiveCell.Text = "Yes" Then

but I need to test for YES,YEs,Yes,and yes

Do I really need to nest four If statements to do that?

Thanks for any and all help


--

Dave Peterson


--

Dave Peterson