Userform values do not equal

lwarren30

New Member
Joined
Jul 3, 2018
Messages
35
I am making a duplicate entry notification. But the values will not equal for the notification msgbox to kick in. I have made this work before with another line of code by dim the value as double. But this will not work at all. Please take a look and tell me what you think.

Code:
Dim Line1, Line2, Line3, Line4, Line5 As Double
    
    'LineItem1
    If cb_DFB_OI_QTY1 = 1 And txt_DFB_OI_Price1 = "" Then
        Line1 = 0
        ElseIf cb_DFB_OI_QTY1 = 1 And txt_DFB_OI_Price1 > 0 Then
        Line1 = Me.txt_DFB_OI_Price1.Value
        Else
        Line1 = Me.cb_DFB_OI_QTY1.Value * Me.txt_DFB_OI_Price1.Value
    End If
        
    'Checks for possible duplicate receipt entry
    If Cells(1, 23) = "LIVE" And Cells(2, 1) <> "" Then
        Dim Row As Integer
        Row = 2
        
        'For testing purposes
        If Cells(Row, 14) = Line1 Then
            MsgBox "True" & " " & Cells(Row, 14) & " " & Line1
            Else
            MsgBox "False" & " " & Cells(Row, 14) & " " & Line1
        End If


        Do Until Row = Application.WorksheetFunction.Max(Range("A:A")) + 1
            If Cells(Row, 5) = Me.txt_DFB_OI_Date And (Cells(Row, 8) = Me.cb_DFB_OI_Acct1) And (Cells(Row, 14) = Line1) Then
                Response = MsgBox("A receipt enerted with the same Date and Total was entered on " & Cells(Row, 3) & "." & vbCrLf & vbCrLf & _
                "Would you like to cancel this current batch?", vbYesNo + vbCritical, "Duplicate Receipt Detected")


                Select Case Response
                    Case vbYes
                        'Closes receipt and exit sub
                        Unload Me
                        Exit Sub
                    Case vbNo
                        'Returns to the user form and resumes
                        Exit Sub
                End Select
            End If
            Row = Row + 1
        Loop
    End If
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Your DIM is wrong.
you must declare EACH variable as Double. Only your last one,LINE5 is double.
all the rest are Variant.
so you must:

dim line1 as double, line2 as double, etc....
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top