jcaptchaos2
Well-known Member
- Joined
- Sep 24, 2002
- Messages
- 1,032
- Office Version
- 365
- Platform
- Windows
I have this code that when a button is pushed on a user form after the employee enters a number it adds that number to a list on the "Closed Shop Orders" worksheet (column A), I need some help on using the same type of code to remove a number that is on the list in "Closed Shop Orders" (column A). I would create a userform have an entry box for the employee to enter the number then press a button and it removed the number from that same list.
Code:
Private Sub cmdclshor_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Closed Shop Orders")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a Item number
If Trim(Me.txtclshor.Value) = "" Then
Me.txtclshor.SetFocus
MsgBox "Please enter a Shop Order Number"
Exit Sub
End If
'copy the data to the database
With ws
.Cells(iRow, 1).Value = Me.txtclshor.Value
End With
'clear the data
Me.txtclshor.Value = ""
ActiveWorkbook.Save
End Sub