rharri1972
Board Regular
- Joined
- Nov 12, 2021
- Messages
- 132
- Office Version
- 2019
- Platform
- Windows
Hello!
I have a userform "Cust_Line_Order_Form" with 4 textboxes. Textbox 13,4,&5, and a command button "OK".
When I click the "OK" button I am trying to get the textbox data to worksheet "CUSTOMER ORDER".
The first possible cell is B and row is 12.
B12 (Textbox1), C12(Textbox3), D12 (Textbox4), G12(Textbox5).
I've tried using the .end(xlup) with range ("B12:B") but nothing is happening on the execution of subroutine from button click.
I am using the (xlup) because there may be multiple line items.... each time i hit the ok button i need it to find the next available cell/row to enter the next data starting with B12.
I have a userform "Cust_Line_Order_Form" with 4 textboxes. Textbox 13,4,&5, and a command button "OK".
When I click the "OK" button I am trying to get the textbox data to worksheet "CUSTOMER ORDER".
The first possible cell is B and row is 12.
B12 (Textbox1), C12(Textbox3), D12 (Textbox4), G12(Textbox5).
I've tried using the .end(xlup) with range ("B12:B") but nothing is happening on the execution of subroutine from button click.
I am using the (xlup) because there may be multiple line items.... each time i hit the ok button i need it to find the next available cell/row to enter the next data starting with B12.
VBA Code:
Private Sub CommandButton1_Click()
Dim lr As Long
lr = Sheets("CUSTOMER ORDER").Cells(Rows.Count, "B").End(xlUp).Row + 1
ActiveCell.Value = Me.TextBox1.Value
ActiveCell.Offset(0, 1).Value = Me.TextBox3.Value
ActiveCell.Offset(0, 2).Value = Me.TextBox4.Value
ActiveCell.Offset(0, 3).Value = Me.TextBox5.Value
End Sub
any help will be greatly appreciated!!!