+ Reply to Thread
Results 1 to 3 of 3

Textbox data validation problem

  1. #1
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Textbox data validation problem

    Hello Everyone.. I've got a dropdown list with three options. The macro itself works fine. The problem is data validation. The options are "Left" "Right" "Centre" The problem is if you accidentally hit a key while tabbing through & enter something else in the dropdown, it throws a spanner in the works. What I'm after is a way of checking to see if one of the options is in the dropdown list, if not or something else is, goto an error handler & blank the dropdown. The reason I'm using GoTo is I can't fathom on error resume next. It seems to not fix the problem, just tell me there's a problem, advance through the macro with rubbish as the outcome. I've got the error handlers sorted. I need something like my suggestion below, but preferably I want it to work I have other error handlers that are doing exactly what I need, but this one's stumped me
    Please Login or Register  to view this content.
    I've tried all combinations & tried different solutions & found nothing that works
    Thanks
    Last edited by Philb1; 10-28-2011 at 04:51 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Textbox data validation problem

    I've extracted the part that's giving me grief. Hopefully it's more helpful than my last post

    Please Login or Register  to view this content.
    Thanks

  3. #3
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Textbox data validation problem

    I sussed it & thought I'd show everyone how easy it was & that's the reason I couldn't see it
    [/CODE]
    If Directions.Value = "Left" Then
    Directions.Value = "L"
    Else
    If Directions.Value = "Right" Then
    Directions.Value = "R"
    Else
    If Directions.Value = "Centre" Then
    Directions.Value = "C"
    Else
    Goto handler2

    End If
    End If
    End If
    Call EnterData ' Goes to the data entry private sub[/CODE]

    Now why didn't I see that yesterday

    I see that you can't change the colours of the code text si I had to edit
    Last edited by Philb1; 10-28-2011 at 04:50 PM.

+ 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