Good day all,
I have a userform "command button" that populates a record into the next available row in Sheet "Form" when populated I have assigned a column to generate a unique number for the new row, once complete the code then transfers all data in that row to a second sheet "SWMS", the problem is it also copies the formula across & subsequently changes my unique code, how can I transfer just the data & not the formula?
Private Sub cmdProcess_Click()
Dim LastRow As Long
LastRow = Sheets("Form").Range("a65536").End(xlUp).Row
Sheets("Form").Unprotect Password:="000"
Sheets("SWMS").Unprotect Password:="000"
With Sheets("Form")
.Range("A" & LastRow + 1).Value = TextBox1.Text
.Range("B" & LastRow + 1).Value = TextBox2.Text
.Range("C" & LastRow + 1).Value = TextBox3.Text
.Range("D" & LastRow + 1).Value = TextBox4.Text
.Range("E" & LastRow + 1).Value = TextBox5.Text
.Range("F" & LastRow + 1).Value = TextBox6.Text
.Range("G" & LastRow + 1).Value = TextBox7.Text
.Range("H" & LastRow + 1).Value = TextBox8.Text
.Range("I" & LastRow + 1).Value = TextBox9.Text
.Range("J" & LastRow + 1).Value = TextBox10.Text
.Range("K" & LastRow + 1).Value = TextBox11.Text
.Range("L" & LastRow + 1).Value = ComboBox1.Text
.Range("N" & LastRow + 1).Value = TextBox12.Text
.Range("O" & LastRow + 1).Value = TextBox13.Text
End With
LastRow = Sheets("Form").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Form").Range("A" & LastRow & ":O" & LastRow).Copy Worksheets("SWMS").Range("A1")
Sheets("Form").Protect Password:="000"
Sheets("Form").Protect Password:="000"
MsgBox "SWMS Processed"
End Sub
Thank you all once again for your assistance, this site has been an amazing wealth of information for me - Marco
Bookmarks