On error resume next and cdate problem

D

darrelll

Hello,
I'm having a problem with the code stopping at the (Range("Bid_Date") =
CDate(TextBox5)) line. My code was working fine until I added the lines
for the description check which makes sure the user doesn't add a
description in the textbox of the userform that has been previously
entered. I think the problem may be with the error goto & error resume
next statement. Does anybody have any insight on this?
Thanks,
Darrell


'CHECKS IF DESCRIPTION HAS BEEN PREVIOUSLY ENTERED
'...Added description check

On Error GoTo 100
If Cells.Find(What:=i, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=ylNext,
MatchCase:= _
True).Activate = True Then
MsgBox "The description you entered has been entered on a previous
job."
GoTo 200
End If

100

Range("L3").Select
Cells.Find(What:=n, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=ylNext,
MatchCase:= _
False).Activate


Selection.Offset(0, -10).Select



response = MsgBox("Do you want to add this information to another line
for existing job# " & j & "-" & Format(k, "000") & "?", vbYesNo)
If response = vbYes Then

Unload Existing_Task

Range("EII_Number") = CInt(TextBox1)
Range("Seq_Number") = CInt(TextBox2)
Range("Customer") = TextBox3
Range("Solicitation") = TextBox4

On Error Resume Next
MsgBox Existing_Task.TextBox5
'...Stops at the following line
Range("Bid_Date") = CDate(TextBox5)
If CDate(TextBox5) = False Then
Range("Bid_Date") = TextBox5
End If
 
T

Tom Ogilvy

if your find statment does not find a duplicate entry, then it will try to
activate nothing. That will raise an error.

Dim rng as Range
set rng = Cells.Find()
if not rng is nothing then
rng.activate
msgbox "something"
else
' no duplicate found
End if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top