dannac
Jan 26, 2011, 01:32 PM
I have a user form that inputs data to the next available row.
It starts the data in col A... I need it to start in col B.
Private Sub CommandButton1_Click()
' Make sure Sheet1 is active
Sheets("2011").Activate
' Determine next empty row
'Nextrow = _
'Application.WorksheetFunction.CountA(Range("A:A")) + 1
nextrow = Range("B" & Rows.Count).End(xlUp).Offset(1)
' Transfers the name
Cells(nextrow, 2) = TextBox1.Text
Cells(nextrow, 3) = TextBox2.Text
Cells(nextrow, 4) = TextBox3.Text
Cells(nextrow, 5) = TextBox4.Text
Cells(nextrow, 6) = TextBox12.Text
Cells(nextrow, 7) = TextBox5.Text
Cells(nextrow, 8) = TextBox6.Text
Cells(nextrow, 9) = TextBox7.Text
Cells(nextrow, 10) = TextBox8.Text
Cells(nextrow, 11) = TextBox9.Text
Cells(nextrow, 12) = TextBox10.Text
Cells(nextrow, 13) = TextBox11.Text
Cells(nextrow, 14) = ComboBox1.Text
Cells(nextrow, 15) = ComboBox2.Text
' Clears form for next entry
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox1.SetFocus
End Sub
I thought this line would have it start in col B
Cells(nextrow, 2) = TextBox1.Text
It starts the data in col A... I need it to start in col B.
Private Sub CommandButton1_Click()
' Make sure Sheet1 is active
Sheets("2011").Activate
' Determine next empty row
'Nextrow = _
'Application.WorksheetFunction.CountA(Range("A:A")) + 1
nextrow = Range("B" & Rows.Count).End(xlUp).Offset(1)
' Transfers the name
Cells(nextrow, 2) = TextBox1.Text
Cells(nextrow, 3) = TextBox2.Text
Cells(nextrow, 4) = TextBox3.Text
Cells(nextrow, 5) = TextBox4.Text
Cells(nextrow, 6) = TextBox12.Text
Cells(nextrow, 7) = TextBox5.Text
Cells(nextrow, 8) = TextBox6.Text
Cells(nextrow, 9) = TextBox7.Text
Cells(nextrow, 10) = TextBox8.Text
Cells(nextrow, 11) = TextBox9.Text
Cells(nextrow, 12) = TextBox10.Text
Cells(nextrow, 13) = TextBox11.Text
Cells(nextrow, 14) = ComboBox1.Text
Cells(nextrow, 15) = ComboBox2.Text
' Clears form for next entry
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox1.SetFocus
End Sub
I thought this line would have it start in col B
Cells(nextrow, 2) = TextBox1.Text