Hello All,
I need help with this code. I want to display that last 10 entries that are inputted on sheet 3 into 1stDisplay (List Box) of userform1. At the moment it displays this A4518:J65356. This works but would like to clean it up more. New entries are being made every day. Thank You below is code.
Private Sub cmdRemove_Click()
Dim wks As Worksheet
Dim AddNew As Range
Set wks = Sheet3
Dim s As String
s = "MA20-"
Set AddNew = wks.Range("A65356").End(xlUp).Offset(1, 0)
AddNew.Offset(0, 0).Value = txtBadge.Text
AddNew.Offset(0, 1).Value = s & txtpartnumber.Text
AddNew.Offset(0, 2).Value = txtquantity.Text
AddNew.Offset(0, 3).Value = txtmachine.Text
lstDisplay.ColumnCount = 5
lstDisplay.RowSource = "A4518:J65356"
Dim iControl As Control
For Each iControl In Me.Controls
If iControl.Name Like "txt*" Then iControl = vbNullString
Next
txtpartnumber.SetFocus
Dim ws As Worksheet
Dim rng As Range
Dim myVal As Range
Set ws = Sheet3
Set rng = ws.Range("C65356").End(xlUp)
For Each myVal In rng
Next myVal
ThisWorkbook.Save
End Sub
I need help with this code. I want to display that last 10 entries that are inputted on sheet 3 into 1stDisplay (List Box) of userform1. At the moment it displays this A4518:J65356. This works but would like to clean it up more. New entries are being made every day. Thank You below is code.
Private Sub cmdRemove_Click()
Dim wks As Worksheet
Dim AddNew As Range
Set wks = Sheet3
Dim s As String
s = "MA20-"
Set AddNew = wks.Range("A65356").End(xlUp).Offset(1, 0)
AddNew.Offset(0, 0).Value = txtBadge.Text
AddNew.Offset(0, 1).Value = s & txtpartnumber.Text
AddNew.Offset(0, 2).Value = txtquantity.Text
AddNew.Offset(0, 3).Value = txtmachine.Text
lstDisplay.ColumnCount = 5
lstDisplay.RowSource = "A4518:J65356"
Dim iControl As Control
For Each iControl In Me.Controls
If iControl.Name Like "txt*" Then iControl = vbNullString
Next
txtpartnumber.SetFocus
Dim ws As Worksheet
Dim rng As Range
Dim myVal As Range
Set ws = Sheet3
Set rng = ws.Range("C65356").End(xlUp)
For Each myVal In rng
Next myVal
ThisWorkbook.Save
End Sub