Re: Shorter 'Or' Statement?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



With your example you could reduce your Or's if you use UCase.
s = UCase(Range("B" & CurRow))

Also faster to assign the value to a variable rather than reading the cell
multiple times.

Maybe 'Like' might work for you

If Range("B" & CurRow) Like "[OXox]" then
or
If Ucase("B" & CurRow) Like "[OX]" then

Regards,
Peter T

"Bigfoot17" <Bigfoot17@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B739F01C-E734-4865-8A3E-13D8F230CB51@xxxxxxxxxxxxxxxx
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?

Thanks.


.



Relevant Pages

  • Re: Compound IF statement
    ... Thank you so much for reading my plea and I apologize for being vague. ... If Col 1 has BA and if the same cell in Col 2 has DC, ... Then you say you want to "sum those entries". ... You would simply put the UDF name and whatever ...
    (microsoft.public.excel.programming)
  • Monitoring cells that have data changed
    ... I am creating a group of spreadsheets that will contain meter reading ... the first cell has been changed. ... user changes but I can monitor subsequent cells. ...
    (microsoft.public.excel.programming)
  • Re: Create "model" cell to make a table from
    ... If you scan to RTF, you have used some form of OCR (Optical Character ... Reading) software to convert the image to editable text. ... Word MVP web site http://word.mvps.org ... gridless table from a selected cell. ...
    (microsoft.public.word.tables)
  • Re: Create "model" cell to make a table from
    ... the type of media file you use when scanning in a B+W graphic is critical. ... This produced a great quality image that ... Reading) software to convert the image to editable text. ... gridless table from a selected cell. ...
    (microsoft.public.word.tables)
  • Re: 15 day moving average doesnt update.
    ... In the workbook that operates correctly, the function shown appears when I ... select cell D2. ... Column D is the Moving Average answer column.). ... > average figure when I enter todays reading. ...
    (microsoft.public.excel.worksheet.functions)