vbnewbiebastard
New Member
- Joined
- Mar 20, 2002
- Messages
- 1
hey... I'm making a vb script that beeps and gives a msgbox if a user types in more than 25 characters in a string. The following code works when I try it with 1 cell, but I get a data mismatch error when I try to check the contents of a merged cell. Is there something besides excel.range.value I should be using?
Thanks in advance,
-ROb
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim ThisCell As String
If Target.Column = 2 And Target.Row = 15 Then
ThisCell = Mid(Target.Value, 26, 1)
If ThisCell <> "" Then
Beep
foo = MsgBox("Please enter no more than 26 characters", vbOKOnly)
Target.Value = "enter text here"
End If
End If
End Sub
Thanks in advance,
-ROb
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim ThisCell As String
If Target.Column = 2 And Target.Row = 15 Then
ThisCell = Mid(Target.Value, 26, 1)
If ThisCell <> "" Then
Beep
foo = MsgBox("Please enter no more than 26 characters", vbOKOnly)
Target.Value = "enter text here"
End If
End If
End Sub