Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

run time error 1004

Status
Not open for further replies.

pmover

Mechanical
Sep 7, 2001
1,507
All,
sometimes people are forgetful...

a run time error 1004, autofilter method of range class failed is received.

i believe that the error problem is due to not referencing the correct library. does anyone have any recommendations as to the correct reference library to refer to or other suggestions?

The following code is attached to an activex combination box, placed in a worksheet named Sheet1.

This code works for other pc's, but not this one.

Appreciate your suggestions/recommendations.

Private Sub EquipmentDescription_Change()
Selection.AutoFilter Field:=1, Criteria1:="X"
End Sub

-pmover
 
Replies continue below

Recommended for you

pmover,

I think you are on the right track. I would would select Tools / References from the VBA Editor menu and see which libraries are checked. Compare this on a computer where the combo box function works vs. where it doesn't. This should point you to the missing library.
 
All,

msmith, thanks for the response.

an update, the pc's in question have different versions of excel (97 and 2000). the code and action performs as programmed on pc with version 2000 and not as programmed on pc with version 97.

in checking the references on both pc's, the descriptions are identical, but the version numbers are different. the 2000 version has the more updated version.

i've enhanced the code to include selecting the filter range, autofilter, and then setting the filtering criteria on the pc with version 97 and it performs well. but this is a bastard way of accomplishing the task with user's having different versions of excel.

anyone explain why the one-line of code performs well with 2000 version of excel and not for version 97? recommended corrective action or an alternative is appreciated as well.
-pmover
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor