ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Autofilter error in '97, not 2000 (https://www.excelbanter.com/excel-programming/293751-vba-autofilter-error-97-not-2000-a.html)

Foggy

VBA Autofilter error in '97, not 2000
 
I have a VBA Excel macro which runs happily in Office 2000 but falls
over with the 1004 error ("Autofilter method of Range Class Failed")
in Office 97 (SR 2)

The code in question is
Sheets(3).Range("A4")..AutoFilter , _
field:=7, _
Criteria1:= "*Open*"

This works fine in Office 2000, but all users still using Office 97
report this error (tried both NT and W2K OS's)
I have tried the MS KB and have trawled the web and usenet for a
couple of days now but I have found no solution.
Can anyone help?
TIA

Foggy

Dave Peterson[_3_]

VBA Autofilter error in '97, not 2000
 
Whenever I see the 1004 error with words that say it worked in xl2k, but not
xl97, I think of code being run from a control on the worksheet from the
ControlToolbox toolbar. (Like a commandbutton).

If that describes your situation, then try changing the .takefocusonclick
property of that control to False.

If the control you're using doesn't have that property, then add this line near
the top of your code:

activecell.activate



Foggy wrote:

I have a VBA Excel macro which runs happily in Office 2000 but falls
over with the 1004 error ("Autofilter method of Range Class Failed")
in Office 97 (SR 2)

The code in question is
Sheets(3).Range("A4")..AutoFilter , _
field:=7, _
Criteria1:= "*Open*"

This works fine in Office 2000, but all users still using Office 97
report this error (tried both NT and W2K OS's)
I have tried the MS KB and have trawled the web and usenet for a
couple of days now but I have found no solution.
Can anyone help?
TIA

Foggy


--

Dave Peterson


Foggy

VBA Autofilter error in '97, not 2000
 
On Thu, 01 Apr 2004 21:28:35 -0600, Dave Peterson
wrote:

Whenever I see the 1004 error with words that say it worked in xl2k, but not
xl97, I think of code being run from a control on the worksheet from the
ControlToolbox toolbar. (Like a commandbutton).

If that describes your situation, then try changing the .takefocusonclick
property of that control to False.

If the control you're using doesn't have that property, then add this line near
the top of your code:

activecell.activate


Thanks for this, but I have already tried it.
The problem occurs in two places.
Firstly in the Workbook_Open event and then later as a result of
comboboxes on the actual sheet.
Any further help is appreciated.

Foggy

Dave Peterson[_3_]

VBA Autofilter error in '97, not 2000
 
I don't have a next guess.

You may want to post a few more lines of code.

Foggy wrote:

On Thu, 01 Apr 2004 21:28:35 -0600, Dave Peterson
wrote:

Whenever I see the 1004 error with words that say it worked in xl2k, but not
xl97, I think of code being run from a control on the worksheet from the
ControlToolbox toolbar. (Like a commandbutton).

If that describes your situation, then try changing the .takefocusonclick
property of that control to False.

If the control you're using doesn't have that property, then add this line near
the top of your code:

activecell.activate


Thanks for this, but I have already tried it.
The problem occurs in two places.
Firstly in the Workbook_Open event and then later as a result of
comboboxes on the actual sheet.
Any further help is appreciated.

Foggy


--

Dave Peterson



All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com