View Full Version : 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
Admin
05-04-2013, 11:31 AM
Hi IJC,
Welcome to ExcelFox !!
PFA.
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
Admin
05-04-2013, 06:53 PM
Replace the existing code with the following
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
Thank you and appreciated
IJC
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.