+ Reply to Thread
Results 1 to 5 of 5

Worksheet_Change event not working in cells with data validation

  1. #1
    Registered User
    Join Date
    10-21-2015
    Location
    Australia
    MS-Off Ver
    10
    Posts
    2

    Worksheet_Change event not working in cells with data validation

    Hi;

    I am a 'try it til it works' VBA user, with an unfortunately sketchy idea of what's really going on. I have a table with data validation to ensure only appropriate entries are made. However, anyone may simply type an entry that is spelled the same but does not have the proper case, thus my attempt as follows:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub

    If LCase(Target.Value) = "not in class" Or LCase(Target.Value) = "not rated" Or LCase(Target.Value) = "did not submit" Then
    Target.Value = Application.Proper(Target.Value)
    Else: Target.Value = UCase(Target.Value)
    End If

    End Sub

    The code works fine outside of the cells with data validation applied, but crashes with feeling in the data validation cells. Please help?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: Worksheet_Change event not working in cells with data validation

    Try this:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: Worksheet_Change event not working in cells with data validation

    See the example workbook attached.

    Oh, and please use Code Tags

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-21-2015
    Location
    Australia
    MS-Off Ver
    10
    Posts
    2

    Re: Worksheet_Change event not working in cells with data validation

    Thanks heaps for the quick response. I will have a go at this tomorrow night - getting a bit late here. Apologies re: the code tags, and thanks for your explanation of what's needed in that area. I will let you know how I go.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: Worksheet_Change event not working in cells with data validation

    You're welcome.

+ 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. worksheet_change event stops working
    By kutach770 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-12-2023, 12:21 PM
  2. Worksheet_Change Event not working
    By dgibney in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2015, 02:21 PM
  3. [SOLVED] worksheet_Change event not working as intended.
    By Kramxel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2015, 04:00 AM
  4. Run Macro On Data Validation List Without Worksheet_Change Event?
    By runofthemill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-27-2013, 04:12 PM
  5. Worksheet_change event add / remove validation
    By tone640 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-05-2012, 02:11 PM
  6. Worksheet_Change event not working on xl2003
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2008, 12:38 PM
  7. Problem with Data Validation Dropdown List / Worksheet_Change Event
    By wla6h@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2006, 05:29 PM

Tags for this Thread

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