+ Reply to Thread
Results 1 to 10 of 10

Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

  1. #1
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    Need Help with Error Handling on these 2 combo box (start - end) they drive the relationship for the rest of my reporting.

    I have the boxes currently set as style = fmstyleproperty - 2, but I would like to be able type the values to use the full functionality of the combo boxes. I tried matchrequired, but because the End combo box is list is dependent on the Start's selection, the coding is kind of tricky, I think.
    I also saw something about trapping the error by identifying Control.Listindex = -1, but not sure how to apply in this situation.

    Not sure how I can solve this, I posted the entire work book as there's too many moving parts for me to isolate. The combo boxes are on Sheet5 or Reporting, they are Start and End. I would really appreciate the help

  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: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    What error are you trying to deal with?

    This works when selecting from TestsStart but it doesn't work when typing in it.
    Please Login or Register  to view this content.
    How are you populating TestsStart and TestsEnd?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    Hi Norie,

    Thanks for all your help so far. Trying to deal with Subscript Error that occurs when typing in to the Textbox. I was able to write everything in sequence so that selecting from the drop down doesn't create an error. But cannot prevent the typing errors, so I just cut the typing off till I can solve.

    Note: MatchRequired = True
    So if you switch the typing back on a couple of errors can occur:
    1. In either TestsStart or TestsEnd, if type something not in List => Subscript out of range occurs when filling an array

    2. If type such that TestsEnd.value > TestsStart => code crashes (different errors)

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

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    If you try the code I suggested you'll get neither of those errors.

  5. #5
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    Norie = Genius!

    Got it, dagg, that's a beautiful solution. So then I can control what happens when foolishness is selected. I'm amazed not going to lie. I cannot seem to find a way to promt the user to select a valid case or automatically reset when incorrect value selected. Everything I do seems to limit the ability to type or create a new error? and for some reason I can only type one digit in TestsEnd
    Last edited by cmore; 10-20-2013 at 12:24 AM.

  6. #6
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    For some reason if I add this code, typing a value in TestsStart combobox that is actually in the box still generates the MsgBox

    Please Login or Register  to view this content.

  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: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    What is that code meant to do and where is it located?

    What are the variables m, n, TestTaken, TStart and TEnd?

  8. #8
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    I'm completely blown up now. I was trying accomplish Declare public variables and manage the Start/End errors to revert back to sensible ranges and now don't know where code starts or ends. EnableEvents = False Isn't working, at a loss Going to try and start again I guess.

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

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    To be honest public variables aren't always the best solution.

    Personally I avoid them wherever possible.

    Is this part of the code just for populating/synchronising the 2 comboboxes and making sure entries in them are valid?

  10. #10
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Error Handling on 2 Combo Box relationship (on Worksheet) to allow typing

    So that's what I thought, so I scrapped using them. But then it seems like I'm doing things over and over again. So I was wondering if I should rethink things. So 2 things, yes popping and syncing the 2 combos, but I am also trying to eliminate the 75 named ranges I have by loading for instance the conversion and answer sheet as arrays and populating all the inputs from VBA. But I cannot finalize the controls. For instance, if I get a incorrect range, I'd like to have a msgbox state so, and then revert to the defaults Listindex on 'Ok', if that makes sense?

+ 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. ERROR Handling on Pivot Table with Combo box workaround
    By hitxrafa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2012, 06:06 AM
  2. error handling on worksheet functions
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-11-2007, 02:38 PM
  3. Error Handling Using For/Next and Worksheet Functions
    By BigBas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2007, 12:13 PM
  4. Combo box / Label box relationship
    By mike703 in forum Excel General
    Replies: 1
    Last Post: 09-06-2006, 06:03 PM
  5. [SOLVED] Error Handling for Duplicate Worksheet Names
    By MWS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2006, 02:25 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