multiple cells with email addresses add to code

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
hi i have the below code where i want to add a range to the email address located in sheet (email links) i have done for example the A2:A20 but this doesnt seem to work it only find the email address in A2 and not in A3, A4, A5 etc, please can you help me wioth this? thanks for your help it is really appreciated.

Code:
Private Sub CommandButton4_Click()

Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String

Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)

        aEmail.Body = "Hi There," & Chr(10) & vbCrLf & _
                      "Appt Number: " & Me.TextBox1.Value & Chr(10) & _
                      "MPAN / MPRN: " & Me.TextBox2.Value & Chr(10) & _
                      "Time Slot: " & Me.TextBox3.Value & Chr(10) & _
                      "PostCode: " & Me.TextBox6.Value & Chr(10) & _
                      "Status: " & Me.ComboBox1.Value & Chr(10) & _
                      "Reason: " & Me.ComboBox2.Value & Chr(10) & _
                      "Additional Notes: " & Me.TextBox7.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10)
        aEmail.Recipients.Add (Worksheets("Email Links").Range[B]("A2:A20")[/B].Value)
    
        aEmail.CC = (Worksheets("Email Links").Range[B]("B2:B20")[/B].Value)
        aEmail.BCC = ""
        aEmail.Subject = "" & UserForm7.ComboBox1.Value & "  " & UserForm7.TextBox6.Value & "  " & UserForm7.TextBox3.Value & " " & Worksheets("Northants").Range("J1").Value
        aEmail.Display
       

Dim emptyRow As Long

With ThisWorkbook.Sheets("Northants")
   emptyRow = Cells(Rows.Count, "A").End(xlUp).Row + 1

  
   .Cells(emptyRow, 1).Value = TextBox1.Value
   .Cells(emptyRow, 2).Value = TextBox2.Value
   .Cells(emptyRow, 3).Value = TextBox3.Value
   .Cells(emptyRow, 6).Value = TextBox6.Value
   .Cells(emptyRow, 10).Value = ComboBox1.Value
   .Cells(emptyRow, 8).Value = ComboBox2.Value
   .Cells(emptyRow, 7).Value = TextBox7.Value
   .Cells(emptyRow, 5).Value = ComboBox3.Value
   
End With
Unload Me

End Sub
 
Hi, anything else i can try please, thank you so far with your help as well.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

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