MWhiteDesigns
Well-known Member
- Joined
- Nov 17, 2010
- Messages
- 646
- Office Version
- 2016
- Platform
- Windows
Hey Guys,
I have finally finished all the code for my userform shown below.
I've poked around and I found a thread which directed me to; http://www.rondebruin.nl/sendmail.htm.
But I am not quite sure what to do.
Basically what I want to accomplish is to generate an email AFTER the user clicks the submit button to input the data to the spreadsheet. I also just want the email to contain the range A,1 to P,30. But I want it done all in one click. So the user "clicks" submit, the data is transposed to the sheet and it generates and email.
I have finally finished all the code for my userform shown below.
I've poked around and I found a thread which directed me to; http://www.rondebruin.nl/sendmail.htm.
But I am not quite sure what to do.
Basically what I want to accomplish is to generate an email AFTER the user clicks the submit button to input the data to the spreadsheet. I also just want the email to contain the range A,1 to P,30. But I want it done all in one click. So the user "clicks" submit, the data is transposed to the sheet and it generates and email.
Code:
Private Sub SubmitCommand_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Sheets("HVS Attrition")
irow = ws.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).Row
With ws
.Cells(5, 3).Value = NameTextBox.Value
.Cells(9, 3) = EIDTextBox.Value
.Cells(13, 3) = AVAYATextBox.Value
.Cells(17, 3) = DepartmentComboBox.Value
.Cells(19, 3) = EffectiveDateTextBox.Value
.Cells(21, 3) = ReasonComboBox.Value
.Cells(24, 3) = ReportedByTextBox.Value
If Me.YesOptionButton.Value = True Then
.Cells(27, 3) = "Yes"
End If
If Me.NoOptionButton.Value = True Then
.Cells(27, 3) = "No"
End If
If Me.SundayCheckBox.Value = True Then
.Cells(5, 7) = "X"
End If
If Me.MondayCheckBox.Value = True Then
.Cells(7, 7) = "X"
End If
If Me.TuesdayCheckBox.Value = True Then
.Cells(9, 7) = "X"
End If
If Me.WednesdayCheckBox.Value = True Then
.Cells(11, 7) = "X"
End If
If Me.ThursdayCheckBox.Value = True Then
.Cells(13, 7) = "X"
End If
If Me.FridayCheckBox.Value = True Then
.Cells(15, 7) = "X"
End If
If Me.SaturdayCheckBox.Value = True Then
.Cells(17, 7) = "X"
End If
.Cells(5, 11).Value = SundayStartTextBox.Value
.Cells(5, 14).Value = SundayEndTextBox.Value
.Cells(7, 11).Value = MondayStartTextBox.Value
.Cells(7, 14).Value = MondayEndTextBox.Value
.Cells(9, 11).Value = TuesdayStartTextBox.Value
.Cells(9, 14).Value = TuesdayEndTextBox.Value
.Cells(11, 11).Value = WednesdayStartTextBox.Value
.Cells(11, 14).Value = WednesdayEndTextBox.Value
.Cells(13, 11).Value = ThursdayStartTextBox.Value
.Cells(13, 14).Value = ThursdayEndTextBox.Value
.Cells(15, 11).Value = FridayStartTextBox.Value
.Cells(15, 14).Value = FridayEndTextBox.Value
.Cells(17, 11).Value = SaturdayStartTextBox.Value
.Cells(17, 14).Value = SaturdayEndTextBox.Value
.Cells(20, 5).Value = NotesTextBox.Value
End With
End Sub