![]() |
Text message using data validation.
Ok here is what I am doing. I have created a text box that will only display
when certain cells are selected. (Example: Instructions for what to enter in that cell). Also depending on what cell is selected the message will be different. I created a text box and used the following code Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim strTitle As String Dim strMsg As String Dim sTemp As Shape Dim ws As Worksheet Application.EnableEvents = False Set ws = ActiveSheet Set sTemp = ws.Shapes("txtInputMsg") On Error GoTo errHandler If Intersect(Target, ws.Cells.SpecialCells(xlCellTypeAllValidation)) Is Nothing Then sTemp.TextFrame.Characters.Text = "" sTemp.Visible = msoFalse Else If Target.Validation.InputTitle < "" Or _ Target.Validation.InputMessage < "" Then strTitle = Target.Validation.InputTitle & Chr(10) strMsg = Target.Validation.InputMessage With sTemp.TextFrame .Characters.Text = strTitle & strMsg .Characters.Font.Bold = False .Characters(1, Len(strTitle)).Font.Bold = True End With sTemp.Visible = msoTrue Else sTemp.TextFrame.Characters.Text = "" sTemp.Visible = msoFalse End If End If errHandler: Application.EnableEvents = True Exit Sub End Sub This works great other than if I lock the sheet the message will not change when I select a different cell. I have unlocked the cells that the messages are to populae for, and unloked the text box. Is there a way to lock the sheet and still have the message change according to the cell that is selected? I hope this all makes sense. Can anyone help me with this? |
All times are GMT +1. The time now is 02:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com