View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Jeff Johnson[_2_] Jeff Johnson[_2_] is offline
external usenet poster
 
Posts: 32
Default Shorter 'Or' Statement?

"Bigfoot17" wrote in message
...

I have the following line working, but it seems that perhaps the line could
be shortened:
If Range("B" & CurRow) = "X" Or Range("B" & CurRow) = "x" Or Range("B" &
CurRow) = "O" Or Range("B" & CurRow) = "o" Then
If I needed to add a few more acceptable characters would I continue
adding
more 'or' statements or can I try another method?


To touch on a different issue, you should note that every single time you
have Range("B" & CurRow) written, it will be evaluated. Therefore it's
evaluated FOUR times in your statement above. You can save a little time by
doing something like this:

Dim CellValue As String

CellValue = Range("B" & CurRow).Value

If CellValue = "blah" Or CellValue = "Yada" Or ...<etc.