Code / Macro help

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,032
Office Version
  1. 365
Platform
  1. 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
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,548
Messages
6,179,443
Members
452,915
Latest member
hannnahheileen

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