Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Marcus
 
Posts: n/a
Default 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?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
32,000 data points error message DavidJ726 Charts and Charting in Excel 4 April 5th 06 08:21 PM
Data Validation Input Message Sandy Excel Worksheet Functions 1 March 8th 06 03:19 PM
How change dimensions of data label text box in pie chart? Gouden Willem Charts and Charting in Excel 3 March 7th 06 12:11 PM
Problem organizing text data into new excel page Tony Excel Worksheet Functions 3 October 21st 05 08:19 PM
Data validation, cell protection or other method? KG Excel Discussion (Misc queries) 5 June 17th 05 05:22 AM


All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"