Results 1 to 5 of 5

Thread: Make cells visible based on Data Validation criteria

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Make cells visible based on Data Validation criteria

    Hi

    I have a form and need an option in the form where Text is only visible if Probation is selected.If Probation is selected then all the text in the column "To Be Completed By:" is visible and if Post Probation is selected then there is no visible text in "To Be Completed By:"

    I used data validation for selecting Probation or Post Probation....

    Thanks

    IJC
    Excel 2013
    Attached Files Attached Files

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi IJC,

    Welcome to ExcelFox !!

    PFA.
    Attached Files Attached Files
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0
    That is excellent. Thank you

    Is there a way to protect the cells which have text in them (column "To Be Completed By:" ). I do not want anyone to delete the text from within these cells as at the moment the text can be deleted.Can the cells have a password or something which stops the text from being deleted without affecting the dropdown list you set up with code


    Thanks again

  4. #4
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Replace the existing code with the following

    Code:
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Target.Address(0, 0) <> "K6" Then Exit Sub
        
        
        Const PassWD    As String = "pass"
        
        Me.Unprotect PassWD
        
        If InStr(1, Target.Value, "post", 1) Then
            Range("l10").Resize(Me.UsedRange.Rows.Count).Font.Color = Target.Interior.Color
        Else
            Range("l10").Resize(Me.UsedRange.Rows.Count).Font.Color = Target.Font.Color
        End If
        
        Me.Cells.Locked = False
        Me.Range("l10").Resize(Me.UsedRange.Rows.Count, 3).Locked = True ',3 because the columns are merged
        Me.Protect PassWD
        
    End Sub
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  5. #5
    Junior Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0
    Thank you and appreciated

    IJC

Similar Threads

  1. Select Group Of Cells Using Data Validation
    By rich_cirillo in forum Excel Help
    Replies: 7
    Last Post: 06-09-2013, 05:55 PM
  2. Replies: 3
    Last Post: 05-23-2013, 11:17 PM
  3. Summing Data based on certain criteria
    By Howardc in forum Excel Help
    Replies: 7
    Last Post: 01-30-2013, 07:12 PM
  4. Split data based on criteria
    By Mahesh.sreekakulam in forum Excel Help
    Replies: 3
    Last Post: 06-08-2012, 09:30 PM
  5. Replies: 7
    Last Post: 03-06-2012, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •