Userform: Delete row when multiple criteria is met

kimberly090

Board Regular
Joined
May 22, 2014
Messages
99
Hi,

I have 2 sheet on my excel workbook.
1 is Stock In sheet and 1 is Stock Out sheet.

I wish to store the information in Stock Out sheet when the data is found in Stock In.

Stock In sheet:
AFol_YBELEZHFf124cb7ZGVJpWPql9uDM8QMQA60Sg=w476-h207-p-no


Stock Out sheet:

C_BQ2U8gUM4YtHdqXGsQm7UExSC_CMQovzDIY_GkOw=w382-h220-p-no


For example, the Stock Out sheet only will able to accept the data when the PT# and the Rack is tally with the detail in Stock In sheet.

As below will be the code for my delete button inside my userform:

Code:
Private Sub TrackOut_Click()Sheets("Stock Out").Activate
Dim cDelete As VbMsgBoxResult
                   With Me
                            If Len(.TextBox1.Value) * Len(.PT.Value) * Len(.Rack2.Value) * _
                Len(.Operator2.Value) = 0 Then
            MsgBox "Please Complete All Fields Before Submit"
        Else
        
        cDelete = MsgBox("Are you sure that you want to delete this record", vbYesNo + vbDefaultButton2, "Track Out")
        If cDelete = vbYes Then
           If Sheets("Stock In").Columns(2).Find(What:=PT.Text) Is Nothing Then
              MsgBox "No stock inventory for this PT#"
              Exit Sub
           End If
           eRow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
            Cells(eRow, 1).Value = TextBox1.Text
            Cells(eRow, 2).Value = PT.Text
            Cells(eRow, 3).Value = Rack2.Text
            Cells(eRow, 4).Value = Operator2.Text
            
            Else
            
            If cDelete = vbNo Then
            Unload Me
            End If
            End If
        End If
    End With
   
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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