Displaying Content in Message box

James Robertson

New Member
Joined
Sep 28, 2022
Messages
3
Platform
  1. Windows
Hi all,

Background: I have a spreadsheet that has a list of items, in column A, that changes daily. I currently have a message box that prompts the user to confirm that they have downloaded the items from an internal server. Here is Current box and example spreadsheet:
1676563279386.png
1676562607142.png


Question: Can I put the items in the message box to confirm they know what they need to download? If so, what would the code be for this?
1676562774252.png


Thank you,
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
VBA Code:
Sub DisplayUniqueColumnA()
    Dim lastRow As Long
    Dim message As String
    Dim uniqueValues As New Collection
    Dim i As Long
    Dim wb As Workbook
    Set wb = Workbooks("WorkbookName.xlsx")
    Dim ws As Worksheet
    Set ws = wb.Worksheets("Sheet1")
   
    lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
   
    For i = 1 To lastRow
        On Error Resume Next
        uniqueValues.Add ws.Cells(i, 1).Value, CStr(ws.Cells(i, 1).Value)
        On Error GoTo 0
    Next i
   
    For i = 1 To uniqueValues.Count
        message = message & uniqueValues(i) & vbNewLine
    Next i
   
    MsgBox message, vbInformation, "Unique Column A Contents"
End Sub
 
Last edited by a moderator:
Upvote 0
Solution
When posting vba code in the forum, please use the available code tags. It makes your code much easier to read/debug & copy. My signature block below has more details. I have added the tags for you this time. 😊
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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