PC Review


Reply
Thread Tools Rate Thread

On click procedure fails, but not during debug

 
 
dan dungan
Guest
Posts: n/a
 
      12th Oct 2007
Hi,

I'm using Excel 2000 and XP pro. When I select a breakpoint and debug
pressing F8, the code seems to work.

When I get to this line of code the variables show the proper values
and the message box does not fire.

For Each rng In myRng
If rng.Value = "" Then
MsgBox "You have not selected a Part Number to quote.",
vbOKCancel
Exit Sub
End If


When I remove the breakpoint and click on the button, the message box
fires.

I don't know why.

Does anyone have any suggestions?

Thanks,

Dan Dungan


This is a portion of my on click procedure:

Private Sub cmdAddPart_Click()
'To prepare for printing--This checks that all required component
prices are entered
Dim rng As Range
Dim myRng As Range
Set myRng = Range("FormulaCriteria")

'To determine how many parts the agent has added,
'Set a variable to count how many times the agent clicks the command
button

Dim clickcount As Variant


Application.EnableEvents = False
'ActiveWorkbook.Unprotect ("pricing")

For Each rng In myRng
If rng.Value = "" Then
MsgBox "You have not selected a Part Number to quote.",
vbOKCancel
Exit Sub
End If
If Len(rng.Value) >= 1 And rng.Offset(0, 6).Value < 1 Then
MsgBox rng.Offset(-1, 0).Value & vbCrLf & "missing.",
vbAbortRetryIgnore, "Missing Price Error"
Exit Sub
End If
If WorksheetFunction.Sum(Range("E83:O83")) < 1 Then
MsgBox "You have not entered a quantity",
vbAbortRetryIgnore
End If
Next rng
Sheets("Print").Select
Columns("P:P").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>0",
Operator:=xlAnd
ActiveSheet.PrintOut
Selection.AutoFilter
Sheets("QuotedPart").Select
Range("A2:C2").Select

 
Reply With Quote
 
 
 
 
dan dungan
Guest
Posts: n/a
 
      12th Oct 2007
On Oct 12, 12:23 pm, dan dungan <stagerob...@yahoo.com> wrote:
> Hi,
>
> I'm using Excel 2000 and XP pro. When I select a breakpoint and debug
> pressing F8, the code seems to work.
>
> When I get to this line of code the variables show the proper values
> and the message box does not fire.
>
> For Each rng In myRng
> If rng.Value = "" Then
> MsgBox "You have not selected a Part Number to quote.",
> vbOKCancel
> Exit Sub
> End If
>
> When I remove the breakpoint and click on the button, the message box
> fires.
>
> I don't know why.
>
> Does anyone have any suggestions?
>


Well its because I didn't press F8 enough times. So, there is some
logic error. I'll work on this.

No help required at this time.

Thanks,

Dan

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Debug a Stored Procedure in VS 2008 Alan Meyer Microsoft ASP .NET 0 15th Oct 2010 04:18 AM
Way to debug stored procedure thru adp? EManning Microsoft Access ADP SQL Server 2 23rd Jun 2005 07:31 PM
Debug.Print in a WITH procedure? Toby Erkson Microsoft Excel Programming 4 15th Dec 2004 10:05 PM
Stored procedure Debug in .Net 2003 Dneupane Microsoft ADO .NET 1 11th Nov 2004 03:35 AM
Help required to debug mailmerge procedure JRB Microsoft Excel Programming 2 23rd Oct 2004 07:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 AM.