Hi All,
Hopefully somebody can help me with this one, I have a userform that is submitting data to the next empty row of columns "T:AB" but the code is only submitting data to columns T and U, could anyone please help me to find out why?
Thanks in advance
Jacob.
Hopefully somebody can help me with this one, I have a userform that is submitting data to the next empty row of columns "T:AB" but the code is only submitting data to columns T and U, could anyone please help me to find out why?
Thanks in advance
Jacob.
Code:
Private Sub CommandButton7_Click()
Dim LastRow1 As Long, lngIndex1 As Long, ws As Worksheet
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ComboBox7.Value
.CC = ""
.BCC = ""
.Subject = "CAOOS" & " " & MonthView1.Value & " " & "Unique ID Number:" & " " & Label4.Caption
.HTMLBody = "Hi" & " " & ComboBox7.Value & "<br>" & "<br>" & "You have a new Customer Acceptance form to fill out." & "<br>" & "<br>" & "This has been submitted by:" & " " & Label1.Caption & "<br>" & "<br>" & "To view new submission" & " " & "<A HREF=""file://" & ActiveWorkbook.FullName & """>Click Here</A>" & "<br>" & "<br>" & "<br>" & "<br>" & "Unique ID Number:" & " " & Label4.Caption
.Send 'or use .Display
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "This row has now been updated", vbOKOnly, "Success"
End With
LastRow1 = Range("S" & Rows.Count).End(xlUp).Row
lngIndex1 = Me.ListBox3.ListIndex
Set ws = Sheets("DATABASE")
ws.Range("T" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox9.Value
ws.Range("U" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.MonthView2.Value
ws.Range("V" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox10.Value
ws.Range("W" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox14.Value
ws.Range("X" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox15.Value
ws.Range("Y" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox16.Value
ws.Range("Z" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox17.Value
ws.Range("AA" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.ComboBox6.Value
ws.Range("AB" & LastRow1).Cells(lngIndex1 + 1) = UserForm1.TextBox18.Value
UserForm1.Hide
End Sub