View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bloomberg Bloomberg is offline
external usenet poster
 
Posts: 5
Default Looping and searching

I have a userform in which the user is to enter two dates, a start date and
an end date. My code then searches a spreadsheet. First I find the cell that
contains the text "Date". I then want to the adress for start date. The code
is:

Do Until IsEmpty(rng(1).Offset(i, 0)) = True Or rng(1).Offset(i, 0).text =
strStartDatumArray(1) = True
i = i + 1
Loop

The problem with the code is that if the startdate is not found it takes the
address of the cell that is one cell below the last cell that contains any
values. Does anyone know how to fix this? I also would like fix the code so
if the user enters a date that is a saturday or a sunday my program will
generate a message box. Is this possible? please help me if you can! Thanks!