Closed Thread
Results 1 to 3 of 3

Loading Worksheet Range to VBA Array

  1. #1
    Registered User
    Join Date
    04-24-2006
    Location
    South Africa
    Posts
    7

    Loading Worksheet Range to VBA Array

    HI!

    I’m trying to populate a combobox control using the following code:

    Please Login or Register  to view this content.
    As the list of names in Sheet1 gets longer, n increases (using the COUNTA function), so when the user form initializes, ComboBox1 get filled with the full list of names. This works fine, BUT I get an “Application-defined or object-defined error” if Sheet1 is not active when the code is running. I could use Activate method, but the problem is that I want to hide (visible=false) the worksheets from the end-user and then I get the same error again!

    Any ideas how to work around this??

    THANKS!!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello JohanF,

    Provided everything is on "Sheet1", this code will find the last row in column "A", and load the combo box "ComboBox1". Change the variables you need to match what you are doing.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    04-24-2006
    Location
    South Africa
    Posts
    7

    Thumbs up

    Thanks Leith!

    I like your approach from a slightly different angle than the one from where I started. I can follow and understand it.

    Here's another suggestion I got from another forum:

    Please Login or Register  to view this content.
    Thanks again!

    Johan

Closed 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