I have a User Form where data entered would be entered in certain cells on either the Client Info tab and/or the Client Measurements tab. For some reason, the code isn't working. Now, I've copied it from another workbook where the code works, and changed the variables, but no success. Any suggestions?
Private Sub cmd_AddNewClient_Click()
Dim iRow As Long
Dim jRow As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Client Info")
Set ws2 = Worksheets("Client Measurements")
'Finds the last occupied row in the worksheet.
If Range("A2") <> "" Then
Rows("2:2").Select
Selection.Insert shift:=x1Down
End If
'Insert an empty row (specifically row 2) in the Client Info and Client Measurements tabs.
iRow = Worksheets("Client Info").Cells(Rows.Count, 1).End(x1up).Offset(1, 0).Row
jRow = Worksheets("Client Measurements").Cells(Rows.Count, 1).End(x1up).Offset(1, 0).Row
'Copies the date entered in frm_NewClients, to the appropriate tabs.
ws1.Range("A2").Value = Me.txt_First
ws1.Range("B2").Value = Me.txt_Last
ws1.Range("C2").Value = Me.txt_Suffix
ws1.Range("D2").Value = Me.txt_Client
ws1.Range("F2").Value = Me.txt_DietStart
ws1.Range("H2").Value = Me.txt_TrainingStart
ws1.Range("J2").Value = Me.cobo_Gender
ws1.Range("K2").Value = Me.txt_DoB
ws1.Range("L2").Value = Me.txt_Age
ws2.Range("C2").Value = Me.txt_Client
ws2.Range("D2").Value = Me.cobo_EntryType
ws2.Range("E2").Value = Me.txt_Height
ws2.Range("F2").Value = Me.txt_Weight
ws2.Range("G2").Value = Me.txt_Chest
ws2.Range("H2").Value = Me.txt_Hips
ws2.Range("I2").Value = Me.txt_Waist
ws2.Range("J2").Value = Me.txt_BicepL
ws2.Range("K2").Value = Me.txt_BicepR
ws2.Range("L2").Value = Me.txt_ThighL
ws2.Range("M2").Value = Me.txt_ThighR
ws2.Range("N2").Value = Me.txt_CalfL
ws2.Range("O2").Value = Me.txt_CalfR
End Sub
Private Sub cmd_AddNewClient_Click()
Dim iRow As Long
Dim jRow As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Client Info")
Set ws2 = Worksheets("Client Measurements")
'Finds the last occupied row in the worksheet.
If Range("A2") <> "" Then
Rows("2:2").Select
Selection.Insert shift:=x1Down
End If
'Insert an empty row (specifically row 2) in the Client Info and Client Measurements tabs.
iRow = Worksheets("Client Info").Cells(Rows.Count, 1).End(x1up).Offset(1, 0).Row
jRow = Worksheets("Client Measurements").Cells(Rows.Count, 1).End(x1up).Offset(1, 0).Row
'Copies the date entered in frm_NewClients, to the appropriate tabs.
ws1.Range("A2").Value = Me.txt_First
ws1.Range("B2").Value = Me.txt_Last
ws1.Range("C2").Value = Me.txt_Suffix
ws1.Range("D2").Value = Me.txt_Client
ws1.Range("F2").Value = Me.txt_DietStart
ws1.Range("H2").Value = Me.txt_TrainingStart
ws1.Range("J2").Value = Me.cobo_Gender
ws1.Range("K2").Value = Me.txt_DoB
ws1.Range("L2").Value = Me.txt_Age
ws2.Range("C2").Value = Me.txt_Client
ws2.Range("D2").Value = Me.cobo_EntryType
ws2.Range("E2").Value = Me.txt_Height
ws2.Range("F2").Value = Me.txt_Weight
ws2.Range("G2").Value = Me.txt_Chest
ws2.Range("H2").Value = Me.txt_Hips
ws2.Range("I2").Value = Me.txt_Waist
ws2.Range("J2").Value = Me.txt_BicepL
ws2.Range("K2").Value = Me.txt_BicepR
ws2.Range("L2").Value = Me.txt_ThighL
ws2.Range("M2").Value = Me.txt_ThighR
ws2.Range("N2").Value = Me.txt_CalfL
ws2.Range("O2").Value = Me.txt_CalfR
End Sub