Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default On error resume next and cdate problem

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default On error resume next and cdate problem

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

--
Regards,
Tom Ogilvy


wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default On error resume next and cdate problem

I appreciate it Tom. That fixed it.
Thanks,
Darrell

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
On Error Resume Next problem Jim May Excel Discussion (Misc queries) 14 November 2nd 07 12:27 PM
On error resume next problem freekrill Excel Discussion (Misc queries) 2 December 7th 05 12:51 AM
CDate Problem sil0000 Excel Programming 7 July 22nd 05 08:24 AM
VBA/XP/2000 On Error Resume Next problem. Frank McLellan Excel Programming 1 June 23rd 05 02:18 AM
On error resume next? question - problem Andrzej Excel Programming 13 June 3rd 05 01:02 PM


All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"