Hi, I write a code to copy data from one worksheet to another, however my code is only able to copy one row, but I need it to copy multiple row
Private Sub CommandButton1_Click()
Set MLSA = Sheets("MasterList-Sawing")
Set SS = Sheets("Sawing Schedule")
malr = MLSA.Range("a65535").End(xlUp).Row
sslr = SS.Range("a65535").End(xlUp).Row
a = 0
For i = 2 To malr
If MLSA.Cells(i, "B") & "" = TextBox1 Then
a = i
Exit For
End If
Next
If a = 0 Then
MsgBox "Sorry, No exiting Part Number", vbOKOnly, "Not Found"
Unload UserForm1
Exit Sub
End If
Set rg = MLSA.Range("A" & a)
rg.Copy SS.Range("D" & (sslr + 1))
Set rg = MLSA.Range("C" & a & ":E" & a)
rg.Copy SS.Range("F" & (sslr + 1))
Set rg = MLSA.Range("F" & a)
rg.Copy SS.Range("J" & (sslr + 1))
Set rg = MLSA.Range("G" & a)
rg.Copy SS.Range("M" & (sslr + 1))
Set rg = MLSA.Range("H" & a)
rg.Copy SS.Range("O" & (sslr + 1))
SS.Cells(sslr + 1, "E") = TextBox1
SS.Cells(sslr + 1, "A") = TextBox2
SS.Cells(sslr + 1, "B") = TextBox3
SS.Cells(sslr + 1, "C") = TextBox4
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub