Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Macro runtime error 1004 with Autofilter

I have a macro that invokes Autofilter, however, when I try to run it, after
receiving input from the user, it fails at the Autofilter command. The
message is Autofilter method of range class failed. Can someone help me with
this? This is the entire macro from the start where it selects a range and
clears it, then selects the range for the filter.

Range("A3").Select
Selection.CurrentRegion.Select
Selection.Clear
Sheets("Satisfaction input sheet").Select
Range("A4").Select
Selection.CurrentRegion.Select
Selection.Copy
Sheets("query").Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & c1 & ",",
Criteria2:="<=" & c2
Range("A3").Select
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro runtime error 1004 with Autofilter

Lorna, See my answer in your original post. Your macro below does not make a
selection to filter. Try this.


Range("A3").CurrentRegion.Clear

Sheets("Satisfaction input sheet").Select
Range("A4").CurrentRegion.Copy Sheets("query").Range("A3")


c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
With sheets("query").Range("A3:D7")' adjust to suit
.AutoFilter
.AutoFilter Field:=1, Criteria1:="=" & c1 & "" _
, Operator:=xlAnd, Criteria2:="<=" & c2 & ""
End With
End Sub



--
Don Guillett
SalesAid Software

"Lorna B" wrote in message
...
I have a macro that invokes Autofilter, however, when I try to run it,
after
receiving input from the user, it fails at the Autofilter command. The
message is Autofilter method of range class failed. Can someone help me
with
this? This is the entire macro from the start where it selects a range
and
clears it, then selects the range for the filter.

Range("A3").Select
Selection.CurrentRegion.Select
Selection.Clear
Sheets("Satisfaction input sheet").Select
Range("A4").Select
Selection.CurrentRegion.Select
Selection.Copy
Sheets("query").Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & c1 & ",",
Criteria2:="<=" & c2
Range("A3").Select


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Macro runtime error 1004 with Autofilter

Thank you for your continued help Don. It must be so satisfying to be such a
clever guy! A great big hug to you. Lorna

"Don Guillett" wrote:

Lorna, See my answer in your original post. Your macro below does not make a
selection to filter. Try this.


Range("A3").CurrentRegion.Clear

Sheets("Satisfaction input sheet").Select
Range("A4").CurrentRegion.Copy Sheets("query").Range("A3")


c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
With sheets("query").Range("A3:D7")' adjust to suit
.AutoFilter
.AutoFilter Field:=1, Criteria1:="=" & c1 & "" _
, Operator:=xlAnd, Criteria2:="<=" & c2 & ""
End With
End Sub



--
Don Guillett
SalesAid Software

"Lorna B" wrote in message
...
I have a macro that invokes Autofilter, however, when I try to run it,
after
receiving input from the user, it fails at the Autofilter command. The
message is Autofilter method of range class failed. Can someone help me
with
this? This is the entire macro from the start where it selects a range
and
clears it, then selects the range for the filter.

Range("A3").Select
Selection.CurrentRegion.Select
Selection.Clear
Sheets("Satisfaction input sheet").Select
Range("A4").Select
Selection.CurrentRegion.Select
Selection.Copy
Sheets("query").Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & c1 & ",",
Criteria2:="<=" & c2
Range("A3").Select



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro runtime error 1004 with Autofilter

Oh, we like hugs. Did it work for you?

--
Don Guillett
SalesAid Software

"Lorna B" wrote in message
...
Thank you for your continued help Don. It must be so satisfying to be
such a
clever guy! A great big hug to you. Lorna

"Don Guillett" wrote:

Lorna, See my answer in your original post. Your macro below does not
make a
selection to filter. Try this.


Range("A3").CurrentRegion.Clear

Sheets("Satisfaction input sheet").Select
Range("A4").CurrentRegion.Copy Sheets("query").Range("A3")


c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
With sheets("query").Range("A3:D7")' adjust to suit
.AutoFilter
.AutoFilter Field:=1, Criteria1:="=" & c1 & "" _
, Operator:=xlAnd, Criteria2:="<=" & c2 & ""
End With
End Sub



--
Don Guillett
SalesAid Software

"Lorna B" wrote in message
...
I have a macro that invokes Autofilter, however, when I try to run it,
after
receiving input from the user, it fails at the Autofilter command. The
message is Autofilter method of range class failed. Can someone help
me
with
this? This is the entire macro from the start where it selects a range
and
clears it, then selects the range for the filter.

Range("A3").Select
Selection.CurrentRegion.Select
Selection.Clear
Sheets("Satisfaction input sheet").Select
Range("A4").Select
Selection.CurrentRegion.Select
Selection.Copy
Sheets("query").Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
c1 = InputBox("Enter Date From")
c2 = InputBox("Enter Date To")
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & c1 & ",",
Criteria2:="<=" & c2
Range("A3").Select




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error 1004 HELP PLS Marcelo P Excel Discussion (Misc queries) 2 May 23rd 07 08:56 PM
What causes runtime error 1004? [email protected] Excel Discussion (Misc queries) 4 October 27th 05 07:15 PM
runtime error 1004 valdesd Excel Discussion (Misc queries) 0 October 12th 05 05:30 PM
runtime error 1004 valdesd Excel Discussion (Misc queries) 2 October 12th 05 03:20 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 11:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"