Results 1 to 2 of 2

Auto change of validated cell when source in data validation changed

Threaded View

  1. #1
    Registered User
    Join Date
    06-22-2022
    Location
    California, USA
    MS-Off Ver
    Microsoft 365
    Posts
    1

    Post Auto change of validated cell when source in data validation changed

    Hello,

    I have a sheet here that I use data validation in the master list worksheet (Example, Column F chooses the fabric type, Column G selects the fabric color, which is dependent of F), the source list is in material color worksheet. How do I allow automatic cell update when the source in the list change? I tried this code in the master list worksheet in visual basics (applied the code to master list worksheet) but didn't work.

    #
    Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim strValidationList As String
    Dim strVal As String
    Dim lngNum As Long

    On Error GoTo Nevermind
    strValidationList = Mid(Target.Validation.Formula1, 2)
    strVal = Target.Value
    lngNum = Application.WorksheetFunction.Match(strVal, Range(strValidationList), 0)

    If strVal <> "" And lngNum > 0 Then
    Application.EnableEvents = False
    Target.Formula = "=INDEX(" & strValidationList & ", " & lngNum & ")"
    End If

    Nevermind:
    Application.EnableEvents = True

    End Sub
    #

    Your help is appreciated!



    Thanks,
    AnnieAppleBee
    Attached Files Attached Files
    Last edited by AnnieAppleBee; 06-22-2022 at 05:41 PM. Reason: Unable to attach file in original post

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Source data to change validated data
    By AirplaneGuy737 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2022, 10:47 PM
  2. Automatically change validated entries when source of validation list changes
    By wallgreen1212 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2017, 08:18 AM
  3. Automatically change validated entries when source of validation list changes
    By suchetherrah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2016, 11:58 AM
  4. change data validation cell when source changes
    By ninny76 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2013, 03:21 AM
  5. Replies: 21
    Last Post: 03-14-2013, 07:33 AM
  6. Replies: 2
    Last Post: 03-17-2011, 09:34 AM
  7. [SOLVED] Auto change formula in cells when source is changed
    By carlo in forum Excel General
    Replies: 5
    Last Post: 06-30-2006, 12:20 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