Results 1 to 2 of 2

Data validation default when selection deleted

Threaded View

  1. #1
    Registered User
    Join Date
    11-12-2019
    Location
    New York
    MS-Off Ver
    2016
    Posts
    16

    Question Data validation default when selection deleted

    One of the file I'm working on has a cookie cutter VBA code to default the data validation selection to "Yes", if an input is deleted.

    Code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim xObjV As Validation
    On Error Resume Next
    Set xObjV = Target.Validation
    If xObjV.Type = xlValidateList Then
     If IsEmpty(Target.Value) Then Target.Value = "Yes"
    End If
    End Sub

    Recently added an additional indicator, with input selection being either "D" or "W". Is there an additional criteria to be added to the above code so that a certain data validation range (i.e., E6:E23) defaults to "Yes", when deleted, and another range (i.e., D6:D23) defaults to "D" when input deleted.

    I attached a mock example, if that helps.

    Thanks for the help in advance!
    Attached Files Attached Files
    Last edited by polishfc; 01-12-2022 at 09:52 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-14-2018, 11:04 AM
  2. Data Validation deleted on Copy & Paste
    By LeafyShroom in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-19-2017, 08:02 PM
  3. [SOLVED] Data Validation Lists Break When Rows are Deleted
    By Maredon2016 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-21-2016, 05:06 PM
  4. Replies: 3
    Last Post: 06-04-2015, 02:27 PM
  5. EXCEL: Ensuring Data Validation Is Not Deleted
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 01:36 AM
  6. Data Validation error from Deleted Cells
    By Lindleman in forum Excel General
    Replies: 4
    Last Post: 05-05-2010, 12:48 PM
  7. John Walkenbach - Ensuring that Data Validation is Not Deleted
    By al007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2005, 05:10 AM

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