Popup for cell change
I'm using Excel 2000. I have a spreadsheet where a user enters numbers for
debits and credits. I'd like to have a popup appear when the user enters a
value incorrectly - ie, debits have to be entered as a positive number,
credits have to be negative.
Also, is there a way to erase or undo the previous entry?
I'm thinking the worksheet_change event is needed here, but what I've tried
doesn't seem to work:
Private Sub Worksheet_Change(ByVal Target As Range)
if ActiveCell.Offset(0, -1).Value = "Debit" and Range("ActiveCell.Value
<1 Then
MsgBox "The number entered needs to be positive"
Elseif ActiveCell.Offset(0, -1).Value = "Credit" and
Range("ActiveCell.Value 1 Then
MsgBox "The number entered needs to be negative"
End If
End Sub
Thanks for any and all help.
--
Craig
|