" = quotes
() = parentheses
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cce17 As Double
If Not Application.Intersect(Target, Range("E17")) Is Nothing Then
cce17 = Len(Target.Value)
If cce17 28 Then
MsgBox "You have entered a value in this field that is " _
& cce17 & " characters in length. " _
& "You will need to shorten your entry by " & cce17 - 28 _
& " characters.", vbAbortRetryIgnore, "InvalidEntry"
End If
End If
End Sub
But I would think that this would be under the worksheet_change event--don't
check when the user changes the selection, check when they hit the enter key.
"rcuatman <" wrote:
I made the changes you suggest. Now moy code looks like this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cce17 As Double
If Not Application.Intersect(Target, Range("E17")) Is Nothing Then
cce17 = Len(E17)
If cce17 28 Then
MsgBox(You have entered a value in this field that is &
cce17 & characters in length. You will need to shorten your entry by
& 28 - cce17 & characters., vbAbortRetryIgnore, "InvalidEntry ")
End If
End If
End Sub
And it will not compile. I get a syntax error.
Did I miss something?
---
Message posted from http://www.ExcelForum.com/
--
Dave Peterson