Thread: If then else
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
dok112[_93_] dok112[_93_] is offline
external usenet poster
 
Posts: 1
Default If then else


Replace the code with this...

Dim r As Variant
Dim WSN As Variant
Set WSN = ThisWorkbook.Sheets("TimeCard")
r = 9
Do Until WSN.Cells(r, 10).Value = ""
If WSN.Cells(r, 10).Value = "Tardy" And WSN.Cells(r, 11).Value = ""
Then
MsgBox "Please enter the amount of time tardy"
Cancel = True
Exit Do
Exit Sub
Else:
r = r + 1
End If
Loop

This should work for you now. I tested it on your book, and it works.
I just had to switch the code around a little.


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=513772