0
我在我的Excel工作簿中有兩張表。 1是存貨在表中,1是存貨表。Excel用戶窗體:當滿足多個條件時刪除行
我希望在Stock In中找到數據時,將信息存儲在Stock Out工作表中。
庫存在片:
脫銷片:
例如,缺貨片僅將能夠接受該數據時,PT#和Rack與Sheet In Sheet中的細節相符。
正如下面將是我的我的用戶窗體中刪除按鈕的代碼:
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
什麼是你的錯誤? – 2015-02-10 08:01:59
它只會刪除PT#但不會檢查機架是否與PT#相符。 – tohobaby 2015-02-10 09:11:11