UserForm Text Box auto sort to Multiple Sheets

Geoffnokc

New Member
Joined
Feb 24, 2011
Messages
1
I have created a userform where I will enter customer data including First name, Last name, address, etc.; it's all pretty standard. I can tell it to create my file or take the data from the text boxes and place them in the corresponding rows I have designated. I have then created a new sheet for each letter of the alphabet. What I would like to be able to do is have the userform look at the customers' last name then automatically post the data to the corresponding sheet in my workbook. Could you please help with this command? Here is what I have so far.

Private Sub cmdCreate_Click()
Dim sData As String
Dim lRowNum As Long
If Lname.Text = "" Then
MsgBox ("Enter a Last Name")
Exit Sub
End If
If AcctNum.Text = "" Then
MsgBox ("Enter the Customers Account Number")
Exit Sub
End If
RowCount = Worksheets("Title").Range("b30").CurrentRegion.Rows.Count
With Worksheets("Title").Range("b30")
.Offset(RowCount, 0).Value = Me.Fname.Value
.Offset(RowCount, 1).Value = Me.Lname.Value
.Offset(RowCount, 6).Value = Me.AcctNum.Value
.Offset(RowCount, 3).Value = Me.Dte.Value
.Offset(RowCount, 2).Value = Me.Address.Value
.Offset(RowCount, 3).Value = Me.Zipcode.Value
.Offset(RowCount, 7).Value = Me.prodnotes.Value
.Offset(RowCount, 5).Value = Me.Emailadd.Value
.Offset(RowCount, 4).Value = Me.PhoneNum.Value
.Offset(RowCount, 8).Value = Me.PurAmt.Value
End With

Thanks,
Geoff
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,215,497
Messages
6,125,155
Members
449,208
Latest member
emmac

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top