+ Reply to Thread
Results 1 to 18 of 18

Variable Array Names

  1. #1
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Variable Array Names

    I have a question.

    Is it possible to have an array name as a variable?

    My mission is to change the selection on a combobox and depending on this selection a specific array need to be read.

    All the array sizes are different and are dynamically populated.

    Can this be done and if so please assist

    Thanks

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    I had to create something simple but the solution here I will implement in the larger program

    Variable Array.xlsm

    Thanks

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Variable Array Names

    You can just assign to their ranges or use named ranges - what do you want to do?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    Yes I could if the data in the arrays came from one workbook but I am working over 5 different CLOSED workbooks. that is why I added the arrays.

    I am creating a multi user database

  6. #6
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    I need to display a different list of of options depending on the combo box selection

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    This can be done but currently you are doing it the wrong way.

    There's no need for this,
    Please Login or Register  to view this content.
    or this.
    Please Login or Register  to view this content.
    Try this.
    Please Login or Register  to view this content.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    Just noticed the closed workbook thing, not going to work without a lot of complication.

  9. #9
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    What would be the best way of doing this?

    i have tried this but am unable to test it as there is a lot more to do before I can run an error free test

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    am I on a track that will get me somewhere?

  10. #10
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    the
    Please Login or Register  to view this content.
    it the reference to another combo box. there are in total 32 boxes (textboxes and combo boxes on the one form) visible or not as the form are completed and as required.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    I'm sorry but you've totally lost me.

    What are you actually trying to do?

  12. #12
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    Look at the uploaded sample and in essence it that what I am trying. Just remember that the data stored in the 15 arrays are spread over many closed workbooks and the basic methods will not work

  13. #13
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    I wave worked more on the quick sample and got it working with the "Select CASE" function.

    My question is that this method is not user friendly and repeating it many time
    (To enter the information and read it back) does not seem to be the best idea

    Is there a better way?
    Variable Array.xlsm

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    Eh, I did look at the uploaded sample and based the code I posted on that.

    However the main problem I see here is the closed workbooks that you mentioned, and that is why I asked what you are trying to do.

    Also, I don't mean what you are trying to do codewise but more of general overview.

  15. #15
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    I have a flexible query that the user set up as they want it to be. If the user select a limitation type the value it must be limited to is populated (this is the point of this thread). The sequence or count can be picked from a list of 12 but limited to maximum 8 (not that I think it will ever get that far).

    So if I pick in the first combo the second combo needs to be populated correctly.

    So if I select "Pick a car" I want to see a list of cars.
    If I select "Pick a Color" I want to see the Colors
    "Pick a Make" I want to see makes of cars.
    .......

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    That kind of thing is pretty straightforward, search for cascading comboboxes.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable Array Names

    Actually, the code I posted, based on the workbook you uploaded, was a good example of how to do this sort of thing.

  18. #18
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Variable Array Names

    I think the best for me would be to write that code into a function and just call the on it when I need it.

    Thanks for your time norie

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 06-18-2015, 09:10 AM
  2. [SOLVED] Help with: Range Array SelectCase Loop delete: Array All Sheet.Names
    By dlow in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-08-2015, 07:11 PM
  3. Replies: 0
    Last Post: 08-29-2013, 10:07 PM
  4. How to declare variable names depending on worksheet names
    By Dynelor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2008, 08:43 AM
  5. Create array of file names/sheet names
    By BVHis in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-06-2008, 11:30 AM
  6. Using variable names to select sheet names
    By mattsgr1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2007, 06:38 AM
  7. Replies: 2
    Last Post: 04-07-2005, 05:06 PM

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