Advanced Filter causes excel to crash

E

Ebrahim Khatami

I have this line of VB code within a program which causes
excel to crash. It is trying to get the unique entries
from a list. It used to work under windows NT but since
XP it became very unreliable and it works on one machine
but not in a different one. I used different variation of
the code but still it is not working. Any Idea ?
(Cells E1 and H1 contain same titles)

Range("E1:E2000").AdvancedFilter
Action:=xlFilterCopy, CopyToRange:=Range("H1"),
Unique:=True
**********************************
OR
' Columns("E:E").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("H1"), Unique:=True
************************************
OR
Columns("E:E").Select
ActiveWorkbook.Names.Add Name:="Test",
RefersTo:=Selection
Range("Test").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("H1"), Unique:=True
*************************************
 
D

Dave Peterson

If you set up a test workbook with minor amounts of data, do you get the same xl
crash?

You may want to try Rob Bovey's code cleaner.
http://www.appspro.com/

It sometimes clears up the unexplainable errors.

If that doesn't help, I'd think about recreating that worksheet. Maybe it's
getting corrupted.
 
P

Paul Robinson

Hi
Have you tried activating the sheet that the filter acts on? This
worked for me when I had, what sounds like, similar problems.
regards
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top