Results 1 to 4 of 4

Extracting 3 Arrays from 1 Array

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-03-2004
    Posts
    102

    Extracting 3 Arrays from 1 Array

    I have a 2-dimensional array [vtData(0, 0)] that is Dimensioned as a Variant; its Lbound for each dimension is 0 and its UBound for dimension1 is 4 and its UBound for dimension2 is 2; therefore, 15 elements. (This array is imported into my VBA Code from Bloomberg.)

    I do NOT want to paste this array into a worksheet; however, in design mode only, I am using the following to do exactly that (and it works):

    ActiveSheet.Range(Cells(8, 1), Cells(8 + UB1, 3)) = vtData(0, 0)
    where UB1 is UBound for dimension1.

    OK, I want to create 3 child arrays (one for each column) from the parent array. (My objective is to connect the individual elements for each column into one string, using a delimiter, and then paste that string into a specified cell in my worksheet.) This is my non-working code:

    Dim Col_One As Variant, x As Integer
    ReDim Col_One(UB1 + 1)
    For x = 0 To UB1
    Col_One(x) = vtData(x, 0)
    Next x
    When stepping-thru my code:
    when x = 0, there are no errors;
    when x = 1, I get the dreaded 'subscript out of range' error.

    Do I need to use WorksheetFunction.Transpose?

    Thanks for a reply.
    Last edited by Chuckles123; 08-22-2007 at 01:59 PM.

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