+ Reply to Thread
Results 1 to 7 of 7

How do I combine a row of a VBA array into a single number/text?

  1. #1
    Registered User
    Join Date
    10-05-2013
    Location
    Moscow, Russia
    MS-Off Ver
    Excel 2007
    Posts
    11

    How do I combine a row of a VBA array into a single number/text?

    Hi!

    I have a VBA array that consists of multiple rows and six columns of numbers. I need to combine each row into a single number. For example, a row goes like this: 1 2 3 4 5 6. And I want to get 123456 as the output.
    How do I do this? I've searched the web, but I haven't found a solution, and I just can't wrap my head around this.

    Best regards,
    dejavision.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How do I combine a row of a VBA array into a single number/text?

    Does this help?

    Please Login or Register  to view this content.
    This places the output in Column 7.

  3. #3
    Registered User
    Join Date
    10-05-2013
    Location
    Moscow, Russia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How do I combine a row of a VBA array into a single number/text?

    Quote Originally Posted by JOHN H. DAVIS View Post
    Does this help?

    Please Login or Register  to view this content.
    This places the output in Column 7.
    Hi, John!

    Thank you very much for your swift reply. It almost solved my problem. Actually I'm dealing with the arrays inside the VBA procedure, as I'm trying not to reference cells because I have million rows in the array. But I have rewritten your procedure like this

    Please Login or Register  to view this content.
    And the only "bug" I have right now is that I have 6 columns in the resulting array which go like this:
    1 12 123 1234 12345 123456.

    And I don't know how to put it all in one column at once.

    However in the 6th column I have exactly the result I want.

    Best regards,
    dejavision.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How do I combine a row of a VBA array into a single number/text?

    Maybe?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-05-2013
    Location
    Moscow, Russia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How do I combine a row of a VBA array into a single number/text?

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe?

    Please Login or Register  to view this content.
    For some reason it gives me 'Subscript out of Range'.

    Best regards,
    dejavision.

  6. #6
    Registered User
    Join Date
    10-05-2013
    Location
    Moscow, Russia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How do I combine a row of a VBA array into a single number/text?

    Quote Originally Posted by dejavision View Post
    For some reason it gives me 'Subscript out of Range'.

    Best regards,
    dejavision.
    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe?

    Please Login or Register  to view this content.
    John, your solution finally worked for me! Thank you very much. I had to change the dimensions of the array to 1D.
    Then I changed your code like this. I also had to use WorksheetFunction.Transpose, because at first the result was a long row, not a column.

    Please Login or Register  to view this content.
    Best regards,
    dejavision.
    Last edited by dejavision; 05-21-2014 at 07:29 PM.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How do I combine a row of a VBA array into a single number/text?

    You're welcome. Glad to hear you got a solution and thanks for the feedback.

+ 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. [SOLVED] Combine text & date1 & date2 into one single cell - end formatting problem - Excel 2007
    By teh.format in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-12-2014, 09:10 PM
  2. sumproduct of a number array and a text array starting with 2 numbers
    By Bishonen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-21-2013, 11:48 AM
  3. Replies: 7
    Last Post: 10-23-2012, 02:29 PM
  4. how to write a code to combine the number in an array
    By yhtsai in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-29-2011, 11:25 PM
  5. [SOLVED] How can I combine text and a function in a single cell
    By slot guy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-19-2005, 01:06 PM

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