Consulting

Results 1 to 6 of 6

Thread: Solved: VBA : multidimensional arrays to fill from a worksheet

  1. #1
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location

    Question Solved: VBA : multidimensional arrays to fill from a worksheet

    Hello,

    I'm new to VBA but I'm training hard to progress.
    I'm currently finding it very hard to solve this problem and I need your insights:

    I have an excel worksheet of 3000 lines * 10 columns
    I need to create on VBA an array containing the informations of this worksheet.
    For example the columns of my excel worksheet are:
    ProductColorWeightSizeValue
    Product A Color A Weight A Size A Value B
    Product B Color A Weight C Size D Value A

    Each line would be coded in my array as
    (A A A A B)
    (B A C D A)

    How can I code the filling of my array ?
    I have no Idea about it

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim ary As Variant

    ary = Range("A3000:J3000")
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location
    Thank you so much !

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Dabo,
    Welcome to VBAX. If this is solved, can you mark it so using the Thread Tools dropdown
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Quote Originally Posted by xld
    [vba]

    Dim ary As Variant

    ary = Range("A3000:J3000")
    [/vba]
    Did you mean
    [VBA]
    ary = Range("A1:J3000")
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location
    Quote Originally Posted by mdmackillop
    Hi Dabo,
    Welcome to VBAX. If this is solved, can you mark it so using the Thread Tools dropdown
    Regards
    MD
    Hello,

    Done !

Posting Permissions

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