+ Reply to Thread
Results 1 to 2 of 2

Variable VBA Array Lengths, insert into cell as string

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Variable VBA Array Lengths, insert into cell as string

    Awkward title but oh well...

    I've never played with VBA arrays, but need to for a project...so, here is the basic array i have built for this;

    Please Login or Register  to view this content.
    Simple enough.
    My array (bl) needs to contain a list of the values in H8 through H23. it works fine, those values do enter the array, or at least that's what my MsgBox bl(4) test told me.

    What I need to happen is the array gets spit into a cell separated by delimiting characters.

    For example, if;

    H8 = "APPLE"
    H9 = "DOG"
    H10 = "PIANO"


    The output I am looking to get is
    'APPLE','DOG','PIANO'

    My bigger question is, how do I get that output from an array of up to 16 values? I know I could;
    "'" & bl(0) & "'.'" & bl(1) & "','" * bl(2)...... and so on to 15, but my output would end up being;
    'APPLE','DOG','PIANO','','','','','','','','','','','','','',' And while this would work, I would prefer to not have blanks.

    Thanks in advance!
    Last edited by Speshul; 09-03-2014 at 04:26 PM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Variable VBA Array Lengths, insert into cell as string

    You could use
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Complex number sorting and addition, variable string lengths.
    By comp in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-11-2014, 03:39 AM
  2. [SOLVED] Extract numbers of variable lengths from cell
    By Nizz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-18-2013, 10:11 AM
  3. Trim/parse from right within cell - string lengths different
    By oprpjm in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2013, 03:55 PM
  4. Multiple named ranges with variable lengths set by user via single cell value
    By devcow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2012, 01:12 AM

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