rifleforger
New Member
- Joined
- Aug 1, 2010
- Messages
- 6
Hi guys I always get run time error 13 whenever I want to add a row in my spreadsheet.
This code is to determine duplicate entries. SO whenever i want to insert a row the run time error 13 occurs
Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Column <> 5) And (Target.Column <> 10) And (Target.Column <> 1) And (Target.Column <> 2) Then Exit Sub
If WorksheetFunction.CountIf(Columns(5), Target.Value) > 1 Then
MsgBox "The serial number you have entered is already existing", vbExclamation
Target.Clear
ElseIf WorksheetFunction.CountIf(Columns(10), Target.Value) > 1 Then
MsgBox "The Device Name you have entered is already existing", vbExclamation
Target.Clear
ElseIf WorksheetFunction.CountIf(Columns(2), Target.Value) > 1 Then
MsgBox "The Device Asset you have entered is already existing", vbExclamation
Target.Clear
ElseIf WorksheetFunction.CountIf(Columns(1), Target.Value) > 1 Then
MsgBox "The System Asset you have entered is already existing", vbExclamation
Target.Clear
End If
End Sub
This code is to determine duplicate entries. SO whenever i want to insert a row the run time error 13 occurs
Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Column <> 5) And (Target.Column <> 10) And (Target.Column <> 1) And (Target.Column <> 2) Then Exit Sub
If WorksheetFunction.CountIf(Columns(5), Target.Value) > 1 Then
MsgBox "The serial number you have entered is already existing", vbExclamation
Target.Clear
ElseIf WorksheetFunction.CountIf(Columns(10), Target.Value) > 1 Then
MsgBox "The Device Name you have entered is already existing", vbExclamation
Target.Clear
ElseIf WorksheetFunction.CountIf(Columns(2), Target.Value) > 1 Then
MsgBox "The Device Asset you have entered is already existing", vbExclamation
Target.Clear
ElseIf WorksheetFunction.CountIf(Columns(1), Target.Value) > 1 Then
MsgBox "The System Asset you have entered is already existing", vbExclamation
Target.Clear
End If
End Sub