S
SkippyPB
I have the following VBA code in my spreadsheet:
Private Sub Worksheet_Change (ByVal Target As Excel.Range)
If Target.Column = 2 Then
ColName = "EMP ID"
lchar = Left(Target.Value, 1)
If lchar = " " Then
cnum = Target.Column
rnum = Target.Row
GoTo FieldErr
End If
End If
..
..
..
..
FieldErr:
MsgBox ColName & " Cannot Begin With a Space"
ActiveCell.offset(rnum, cnum).Activate
..
..
End Sub
The issue I have is the ActiveCell instruction is not putting the
cursor or pointer back into the cell in error. It puts it several
rows and columns away.
Any help would be most appreciated.
Note that this is just one example. I need to perform the same data
validation on several columns, rows of data within the spreadsheet.
Thanks.
////
(o o)
-oOO--(_)--OOo-
"My luck is so bad that if I bought a cemetery,
people would stop dying."
-- Rodney Dangerfield
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove nospam to email me.
Steve
Private Sub Worksheet_Change (ByVal Target As Excel.Range)
If Target.Column = 2 Then
ColName = "EMP ID"
lchar = Left(Target.Value, 1)
If lchar = " " Then
cnum = Target.Column
rnum = Target.Row
GoTo FieldErr
End If
End If
..
..
..
..
FieldErr:
MsgBox ColName & " Cannot Begin With a Space"
ActiveCell.offset(rnum, cnum).Activate
..
..
End Sub
The issue I have is the ActiveCell instruction is not putting the
cursor or pointer back into the cell in error. It puts it several
rows and columns away.
Any help would be most appreciated.
Note that this is just one example. I need to perform the same data
validation on several columns, rows of data within the spreadsheet.
Thanks.
////
(o o)
-oOO--(_)--OOo-
"My luck is so bad that if I bought a cemetery,
people would stop dying."
-- Rodney Dangerfield
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove nospam to email me.
Steve