+ Reply to Thread
Results 1 to 7 of 7

Assigning to an array from a worksheet

  1. #1
    Registered User
    Join Date
    01-27-2011
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2007
    Posts
    16

    Assigning to an array from a worksheet

    Morning All,

    I am trying to populate an array with values stored in a column in one of my worksheets. I realise that I could manually type in all the values in VBA but as there are 200+ of them, I would like VBA to do this for me!

    Thanks for your help!

    Joe
    Last edited by JoWales; 03-17-2011 at 07:11 AM.

  2. #2
    Registered User
    Join Date
    01-27-2011
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Assigning to an array from a worksheet

    Got it, thanks anyway! Here's how I'm doing it if anyone's interested in the future:

    Please Login or Register  to view this content.
    Thanks!

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Assigning to an array from a worksheet

    Thanks for taking the time to post the solution .
    or
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Registered User
    Join Date
    01-27-2011
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Assigning to an array from a worksheet

    Thanks for taking the time to post the solution .
    or

    Please Login or Register  to view this content.
    No Problem

    Using your method, how do I input a value from within my array to a cell?

    If I use, for example,

    Please Login or Register  to view this content.
    I get the error message:

    "Subscript out of range"


    If this needs a new thread then just say and I'll move it.
    Thanks for your help
    Last edited by JoWales; 03-17-2011 at 07:03 AM. Reason: Messed up the coding tags

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Assigning to an array from a worksheet

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-27-2011
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Assigning to an array from a worksheet

    Excellent, thanks!

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Assigning to an array from a worksheet

    Or

    Please Login or Register  to view this content.
    The values will be in clients(1,1) to clients(n,1)

    If you want a 1-dimensional array:
    Please Login or Register  to view this content.
    The values will be in clients(1) to clients(n)



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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