ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error with a Macro (https://www.excelbanter.com/excel-programming/277277-error-macro.html)

Sondra[_2_]

Error with a Macro
 
I have a user who has created a spreadsheet with macros
for each column to run various reports. Each macro reads
the same; however the last column macro keeps erroring
out. I have tried correcting the statement and still can
not get it to run.

Range ("AN1"). Select
Selection.AutoFilter
Selection.AutoFilter Field:=40, Criteria1:="x"

The last statement is the one that keeps erroring. Can
anyone help. I'm very novice to Excel Macros.

Thanks.


Tom Ogilvy

Error with a Macro
 
try

Range ("A1:AN1").CurrentRegion.Select
Selection.AutoFilter
Selection.AutoFilter Field:=40, Criteria1:="x"

--
Regards,
Tom Ogilvy


"Sondra" wrote in message
...
I have a user who has created a spreadsheet with macros
for each column to run various reports. Each macro reads
the same; however the last column macro keeps erroring
out. I have tried correcting the statement and still can
not get it to run.

Range ("AN1"). Select
Selection.AutoFilter
Selection.AutoFilter Field:=40, Criteria1:="x"

The last statement is the one that keeps erroring. Can
anyone help. I'm very novice to Excel Macros.

Thanks.




Sondra Powers

Error with a Macro
 
Tom:

Tried it and it didn't work
Range("A1:AN1").CurrentRegion.Select
Selection.AutoFilter

Selection.AutoFilter Field:=40, Criteria1:="x" (THIS ROW ERRORING)

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Selection.AutoFilter

Any help would be appreciated.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 12:04 AM.

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