View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default vba using the OR operator

The Rows property does not take multiple arguments. If you want to search
all cells in each entire row, try the following:

If Not Range(Rows(1), Rows(iRow)).Find(DateValue("11/13/2005")) Is Nothing
Or _
Not Range(Rows(1), Rows(iRow)).Find(DateValue("11/23/2005")) Is Nothing Then

....Your code Here....

End If

Note also that the example above assumes you are searching for actual dates.
Your original example shows a search for a strings "11/13/2005" and
"11/23/2005." If you really want to search for the string, delete the
DateValue characters from the example.
--
Jay


"Mona" wrote:

Here is my code that does not work:

If Rows(iRow, 1) = ("11/13/2005" Or "11/23/2005") Then
blah blah

I can get the code to work on a single date but not with multiple dates
using "or". I have about 20 dates that I want to check and I could get by
with just repeating the code 20 times but I wanted to do it using a single
statement.

Thank you!!