View Single Post
  #8   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

In my code, I'd set it up like this:

'================================
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler

If Target.Cells.Count 1 Then GoTo exitHandler
If Target.Column = 2 Then
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Target.Value = Worksheets("Codes").Range("C1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)
End If

exitHandler:
Application.EnableEvents = True
Exit Sub

errHandler:
If Err.Number = 13 Or Err.Number = 1004 Then
GoTo exitHandler
Else
Resume Next
End If

End Sub
'=================================

c wrote:
Where exactly do I include this? I have tried it in a few locations and have
come up with nothing. I have the following:

On Error Goto Errhandler:

Code describing location of cell containing lists

Errhandler:
If Error.Number = 13 Then Exit Sub
If Error.Number = 1004 Then Exit Sub
Should it go here?

Code that changes cell value.

End sub

Thanks Again for any help.
c


"Debra Dalgleish" wrote:


Make sure you run the line:

Application.EnableEvents = True

as part of the error handling






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html