+ Reply to Thread
Results 1 to 6 of 6

Making 1-D Array Into 2-D When Using Split to Output to Sheet

  1. #1
    Registered User
    Join Date
    08-27-2008
    Location
    United States
    Posts
    45

    Making 1-D Array Into 2-D When Using Split to Output to Sheet

    Hello all,

    I am trying to do the following. I have a large string of data which I want to split based on vbCrLf. I can do this fine - simply using

    Please Login or Register  to view this content.
    Now, I would also like to be able to spit out ArrayName to column A without having to do a loop, as I have a lot of data to do this for and it takes a considerable amount of time to do it in loop format. Unfortunately I need to make the above array (ArrayName) into a multidimensional array to do this.

    I cannot seem to find a way to do it. Even using something like

    Please Login or Register  to view this content.
    it does not like it, and I do not know a different way to do it. It gives a "Subscript out of range" error, presumably because I am trying to change the first array dimension as well and with preserve it needs to only modify the last dimension.

    If there is a way to do this - essentially take a 1-D array created via the split function and create it in the form that can be quickly output into a worksheet - please let me know as it would be greatly appreciated.

    Thanks in advance,
    GoogleBot

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Making 1-D Array Into 2-D When Using Split to Output to Sheet

    googlebot,

    Please post your workbook - see "Manage Attachments".


    Have a great day,
    Stan
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    08-27-2008
    Location
    United States
    Posts
    45
    Quote Originally Posted by stanleydgromjr View Post
    googlebot,

    Please post your workbook - see "Manage Attachments".


    Have a great day,
    Stan
    Done, should be what you need.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Making 1-D Array Into 2-D When Using Split to Output to Sheet

    googlebot,

    Here you go - nice challenge.

    See the attached workbook "Copy of Example Workbook - googlebot - SDG.xlsm" with the updated "testing" macro.

    Run the macro, and the information from the textbox, is entered into the two dimensional array "NewArray", and then displayed in range K1:L8, to show that it is working correctly.

    When satisfied, remove the lines of code in the macro between the "''''''''''''''''''''''''" lines.


    Have a great day,
    Stan

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482
    How about

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    08-27-2008
    Location
    United States
    Posts
    45
    Andy,

    I think that is exactly what I need. Now I just need to figure out how those functions all work so I can duplicate or manipulate that in the future, thank you

    stanleydgromjr - I was looking to get around doing it in a loop format because having loops for many thousands of lines in multiple times still takes a relatively significant amount of time.

    Thanks all, this is definitely "solved" now

+ 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