Hi!
When I protect worksheet, code below does not work.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = True
On Error GoTo errHandler
Dim wsD As Worksheet
Dim wsC As Worksheet
Set wsD = Worksheets("Data Search")
Set wsC = Worksheets("Part Entry")
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$B$3" Or Target.Address = "$C$3" Or Target.Address = "$H$3" Then
wsC.Range("Database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=wsD.Range("B2:H3"), _
CopyToRange:=wsD.Range("A6:K6"), _
Unique:=False
End If
Exit Sub
errHandler:
Application.EnableEvents = True
MsgBox "Data was not retrieved"
End Sub
Can some one help me protect worksheet and still make code work?
Thank you!
When I protect worksheet, code below does not work.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = True
On Error GoTo errHandler
Dim wsD As Worksheet
Dim wsC As Worksheet
Set wsD = Worksheets("Data Search")
Set wsC = Worksheets("Part Entry")
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$B$3" Or Target.Address = "$C$3" Or Target.Address = "$H$3" Then
wsC.Range("Database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=wsD.Range("B2:H3"), _
CopyToRange:=wsD.Range("A6:K6"), _
Unique:=False
End If
Exit Sub
errHandler:
Application.EnableEvents = True
MsgBox "Data was not retrieved"
End Sub
Can some one help me protect worksheet and still make code work?
Thank you!