+ Reply to Thread
Results 1 to 3 of 3

Adding same items to combo boxes on multiple sheets

Hybrid View

tony2501 Adding same items to combo... 05-02-2011, 06:46 PM
Deamo Re: Adding same items to... 05-02-2011, 08:18 PM
Leith Ross Re: Adding same items to... 05-02-2011, 08:29 PM
  1. #1
    Registered User
    Join Date
    05-02-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    1

    Adding same items to combo boxes on multiple sheets

    Thanks in advance for any help.

    In this workbook I have several(about 25) worksheets, each of which has 3 combo boxes on them, which I want to use to navigate between the different worksheets. So the items in each combobox will be the same on each sheet.

    What I want to do is run some module based code that will propulate the active sheets combo box, the comboboxes are named the same on each sheet.

    The code I was thinking about would be something like:


    SheetName.cboOne.Additem "Item1"

    Where SheetName woud change depending upon the active sheet.

    The problem I have is assigning the sheet name to some sort of variable which would achieve this

    I'm using Excel 2003

    I have also posted this qustion here.
    http://www.vbaexpress.com/forum/showthread.php?t=37276

  2. #2
    Registered User
    Join Date
    04-14-2010
    Location
    NZ
    MS-Off Ver
    2007,2010
    Posts
    86

    Re: Adding same items to combo boxes on multiple sheets

    You can loop through the worksheets and fill the comboboxes using ListFillRange..
    You'll need a named range on the spreadsheet witht the requisite items for the comboboxes (in my example below i usea named range called ItemList

    Sub test()
    Dim ws As Worksheet
    
    For Each ws In ActiveWorkbook.Sheets
        ws.OLEObjects("cbo1").ListFillRange = "ItemList"
    Next
    
    End Sub

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

    Re: Adding same items to combo boxes on multiple sheets

    Hello tony2501,

    Welcome to the Forum!

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to 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