+ Reply to Thread
Results 1 to 7 of 7

Reduce Redundant Code Help Please

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    5

    Reduce Redundant Code Help Please

    Hello I was wondering if someone could help me reduce redundant code. My code is for a drop down menu to navagite through tabs, each tab is to have it's own ActiveX Combobox. My problem is I don't want to write the code to populate that list 160 times for each combobox on each sheet.

    Here is what I got so far for 10 tabs
    Please Login or Register  to view this content.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reduce Redundant Code Help Please

    maybe
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    06-11-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Reduce Redundant Code Help Please

    Ok I am very new so bare with me.

    My "cmbSheet" is what I named my Activex Combobox

    How would I add what you wrote to my code? I got an Object Defined error.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reduce Redundant Code Help Please

    my code replaces yours completely. if you get an error I need to know on which line.
    if it helps my code assumes there is a combobox called cmbSheet on every sheet in the workbook.

  5. #5
    Registered User
    Join Date
    06-11-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Reduce Redundant Code Help Please

    Oh I think i have it, it is working but I think because I don't have all my sheets with the combobox yet when the loop gets to a sheet that doesn't have one I get the error

    Run time 1004

    Application defined or object-defined error

    The code does work for the sheets I have my combobox on.


    Will get back to you, THANK YOU SO MUCH!

  6. #6
    Registered User
    Join Date
    06-11-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Reduce Redundant Code Help Please

    I am getting this error upon opening, code seems to work but I am unsure why I am getting the error.

    I highlighted the code that it says in error.

    Run Time Error 1004

    Unable to get the OLEObjects propertyn of the Worksheet class



    Please Login or Register  to view this content.

    THis is the code i have on the worksheet

    Please Login or Register  to view this content.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reduce Redundant Code Help Please

    are you sure all of your sheets have a control with that name on them?

+ 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