Hi Everyone
I want to show a message that will contain the names of people in a range that is updated regularly. I am using the following code:
The problem I have is , it will only show the person who's name is in cell D2. I have a named range (email2) which currently spans cells D2:D10, but as I said previously, the range can and will grow.Sub Dist_List() Application.ScreenUpdating = False Range("D2").Select Dim strMsg As String Do Until IsEmpty(ActiveCell) strMsg = "The following people are currently on the Message Distribution list:" & vbCrLf & vbNewLine strMsg = strMsg & " • " & Range("D2").Value & vbNewLine ActiveCell.Offset(1, 0).Select Loop MsgBox strMsg, vbInformation, "Distribution List" Application.ScreenUpdating = True End Sub
Does anyone have any suggestions?
Try
Option Explicit Sub Dist_List() Dim rng As Range Dim Cl As Range Dim strMsg As String Set rng = Range(Cells(2, 4), Cells(Rows.Count, 4).End(xlUp)) strMsg = "The following people are currently on the Message Distribution list:" & vbCrLf & vbNewLine For Each Cl In rng strMsg = strMsg & " • " & Cl.Value & vbNewLine Next Cl MsgBox strMsg, vbInformation, "Distribution List" End Sub
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Thank you once again RoyUK, it works perfectly!
Glad it helped.
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks