ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help displaying array contents (https://www.excelbanter.com/excel-programming/278722-need-help-displaying-array-contents.html)

jsatz

Need help displaying array contents
 
I have an array of strings that I'm wanting to display to the user. All
I've been able to do is use the MsgBox command in a loop to display
things one at a time, but I can only get MsgBox to display one line at
a time.

I want to be able to show all my results in one message box that pops
up for the user.

My array basically contains results from a spreadsheet update macro
(basically a log file).

Thanks.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


J.E. McGimpsey

Need help displaying array contents
 
One way:

Dim i As Integer
Dim msg As String
For i = LBound(sArr) To UBound(sArr)
msg = msg & vbNewLine & sArr(i)
Next i
MsgBox Mid(msg, 2)

where sArr is your array of strings.

In article ,
jsatz wrote:

I have an array of strings that I'm wanting to display to the user. All
I've been able to do is use the MsgBox command in a loop to display
things one at a time, but I can only get MsgBox to display one line at
a time.

I want to be able to show all my results in one message box that pops
up for the user.

My array basically contains results from a spreadsheet update macro
(basically a log file).

Thanks.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


jsatz[_2_]

Need help displaying array contents
 
That did it.

Thanks!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


jsatz[_3_]

Need help displaying array contents
 
That did it.

Thanks!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com