+ Reply to Thread
Results 1 to 4 of 4

Use MsgBox to display the contents of an entire array

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007/2010, Outlook 2007/2010
    Posts
    60

    Use MsgBox to display the contents of an entire array

    Dear whoever reads this,

    I have an array of dynamic length which automatically increases in length and populates each additional cell in the array using an IF statement. At the end of the macro I need to show the contents of the entire array using the MsgBox. So my beginning code looks like this.

    Please Login or Register  to view this content.
    And then I want something that says like:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use MsgBox to display the contents of an entire array

    You'll need to cycle through those elements and create a displayable string... keep in mind a MsgBox is not unlimited real estate:

    Please Login or Register  to view this content.
    You could use & "," in place of & vbNewLine to separate the values by a comma.


    Maybe simplest of all:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-22-2013 at 10:51 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-07-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007/2010, Outlook 2007/2010
    Posts
    60

    Re: Use MsgBox to display the contents of an entire array

    Thank you very much. I realize you're right - MsgBox won't expand forever. Where I really want this to go is into an email, though the process should be virtually identical, right?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use MsgBox to display the contents of an entire array

    That should certainly work.

    If that takes care of your question, select Thread Tools from the link at the top of the page and set this thread to SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1