Results 1 to 9 of 9

Validation code with Protected sheet

Threaded View

  1. #1
    Registered User
    Join Date
    06-01-2016
    Location
    Singapore
    MS-Off Ver
    13
    Posts
    55

    Validation code with Protected sheet

    Hello Guys,

    I am using this code to filter out one of the drop down list based on cell entry and I have to protect the sheet post which this code doesnt seem to work, please help.
    I tried unprotect and protect password in the code but that doesn't seems to work. Rest all other sheets with other codes are working fine.

    Private Sub Worksheet_Change(ByVal Target As Range)
      Dim str1 As String
      If Target.Address(0, 0) = "K10" Then
         Range("B5").ClearContents
         On Error Resume Next
            Range("B5").Validation.Delete
         On Error GoTo 0
         str1 = LCase(Target.Value)
         If InStr(1, str1, "@gmail.com") Then
            Range("B5").Validation.Add Type:=xlValidateList, Formula1:="=vld_gmail"
         ElseIf InStr(1, str1, "hotmail.com") Then
            Range("B5").Validation.Add Type:=xlValidateList, Formula1:="=vld_hotmail"
         Else
            Range("B5").Validation.Add Type:=xlValidateList, Formula1:="=vld_all"
         End If
      End If
    End Sub

    Please help
    Last edited by sandu1; 06-07-2016 at 02:45 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Unable to use data validation in protected sheet
    By vimal768 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2014, 06:16 AM
  2. Combobox Data Validation on Protected Sheet
    By medz80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2014, 01:40 AM
  3. Protecting Validation on Protected Sheet
    By mealypudd1ng in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-16-2014, 08:13 AM
  4. Problem with Data Validation VBA code and protected sheets. Please help.
    By drew.j.harrison in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2013, 01:33 AM
  5. Can't add Data Validation to Protected Sheet
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-20-2011, 07:52 PM
  6. Changing cell validation on a protected sheet
    By agentsmith83 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2011, 12:33 PM
  7. [SOLVED] Apply Validation on a protected sheet
    By Frederick Chow in forum Excel General
    Replies: 0
    Last Post: 01-03-2006, 02:00 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