mmushtaq
02-17-2016, 04:32 PM
Hi all,
I'm new to VBA and I have to create a userform that asks the user for FirstName, LastName, and Uniqname and also has a cancel button that closes the program. I have got that down as follows:
Private Sub btncancel_Click()
Me.Hide
End Sub
Private Sub buttonAdd_Click()
Cells(2, 1) = txtFirstName.Text
Cells(2, 2) = txtLastName.Text
Cells(2, 3) = txtUniqname.Text
Columns("A:C").EntireColumn.AutoFit
txtFirstName = ""
txtLastName = ""
txtUniqname = ""
End Sub
However, once the user has entered the information, I need to input the second set of data into the next row. Right now, if I enter a set of data into the userform, then add another set of data, it just occupies the same cells as the ones before. What code do I use so that new data is inputed into the next row? Any help is appreciated.
I'm new to VBA and I have to create a userform that asks the user for FirstName, LastName, and Uniqname and also has a cancel button that closes the program. I have got that down as follows:
Private Sub btncancel_Click()
Me.Hide
End Sub
Private Sub buttonAdd_Click()
Cells(2, 1) = txtFirstName.Text
Cells(2, 2) = txtLastName.Text
Cells(2, 3) = txtUniqname.Text
Columns("A:C").EntireColumn.AutoFit
txtFirstName = ""
txtLastName = ""
txtUniqname = ""
End Sub
However, once the user has entered the information, I need to input the second set of data into the next row. Right now, if I enter a set of data into the userform, then add another set of data, it just occupies the same cells as the ones before. What code do I use so that new data is inputed into the next row? Any help is appreciated.