Show values of Array Elements in a MsgBox

Tim

New Member
Joined
Feb 18, 2002
Messages
4
Is this possible? As my code goes through a worksheet looking for problems, I would like to collect the information in an array. At the end, I want a single MsgBox to show all of the values (elements) in the array.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi Tim,

Yes, you can easily do this. Just concatenate the text you want to display for each item onto the previous text, putting a linefeed-carriage return between each. For example, say you have an account number that is a text string that you want to put in the array every time a problem occurs with that account, and that account number is in a string variable named AcctNo. Define another string variable MsgArray. Each time a problem occurs, add it to the MsgArray string:

MsgArray = MsgArray & vbCrLf & AcctNo

Now at the end of the program display the message:

MsgBox MsgArray, _
vbExclamation, _
"Problem Account List"
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,399
Members
448,957
Latest member
Hat4Life

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