aaronmendes
New Member
- Joined
- Jul 1, 2013
- Messages
- 3
Hi,
I have assigned a code in Userform for the command button to update data as per the input in the Textboxes in Excel.
However, after clicking OK (command button caption name), I want the data to be cleared in the form and also after inputting more data in the form, the OK button should add additional rows in excel.
My code is below
I have assigned a code in Userform for the command button to update data as per the input in the Textboxes in Excel.
However, after clicking OK (command button caption name), I want the data to be cleared in the form and also after inputting more data in the form, the OK button should add additional rows in excel.
My code is below
Code:
Private Sub OK1_Click()
Dim emptyRow As Long
'Make Sheet1 Active
Sheets(1).Activate
'Determine EmptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Export Data to worksheet
Cells(emptyRow, 5).Value = Trades_Asset.Value
Cells(emptyRow, 6).Value = DisputeReason.Value
Cells(emptyRow, 7).Value = CartNo.Value
Cells(emptyRow, 8).Value = CallTrack.Value
Cells(emptyRow, 9).Value = MOcontact.Value
Cells(emptyRow, 10).Value = Misc_comments.Value
End Sub