I'm hoping one of you experts out there can help me with this problem.
When I run the code I have posted below, as part of a Workwheet_Change event, it keeps it returning the following error:
Runtime-time error '1004
Method 'Range' of object'_Worksheet' failed
However, I can run the same code as a macro attached to a button and it works fine without any errors.
Any ideas as to why I keep getting this runtime error and what can I do to fix it?
Thanks a million times to anyone who would be willing to help me on this!
When I run the code I have posted below, as part of a Workwheet_Change event, it keeps it returning the following error:
Runtime-time error '1004
Method 'Range' of object'_Worksheet' failed
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$C$27" Then Exit Sub
If Target.Address(False, False) <> "C27" Then Exit Sub
If Intersect(Target, Range("C27")) Is Nothing Then Exit Sub
Application.Goto Reference:="OtherClearRange"
Selection.ClearContents 'Clears range of previous extracted data
'This is the section of code where the Runtime Error Occurs
Application.Goto Reference:="InputData"
Range("InputData").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Range("Criteria"), CopyToRange:=Range("Extract"), Unique:=True
End Sub
However, I can run the same code as a macro attached to a button and it works fine without any errors.
Any ideas as to why I keep getting this runtime error and what can I do to fix it?
Thanks a million times to anyone who would be willing to help me on this!