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
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