PC Review


Reply
Thread Tools Rate Thread

Automated autofilter error

 
 
Simon
Guest
Posts: n/a
 
      29th Dec 2009
'
Sub Macro3()
'
' Macro3 Macro
' Macro written 07/12/2009 by AXUKLSLAV
'
Dim Retail
Dim Retailtest

Set Retail = Workbooks.Open("N:\mis\EXCEL\EoM\DW-Reports
\Retailfigure.csv")
Set Retailtest = Workbooks.Open("N:\mis\EXCEL\EoM\DW-Reports
\RetailfigureTEST.xls")

Retail.Activate
Range("A1:C100").Copy
Retailtest.Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Range("H1:I1").Copy
Range("J1:K1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Dim Distribution1 As String, DistributionPath1 As Range
Set DistributionPath1 = Retailtest.ActiveSheet.Range("J1")

Dim Distribution2 As String, DistributionPath2 As Range
Set DistributionPath2 = Retailtest.ActiveSheet.Range("K1")

Range("A1:C1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:=DistributionPath1,
Operator:=xlAnd
Selection.AutoFilter Field:=2, Criteria1:=DistributionPath2,
Operator:=xlAnd

Set myRng6 = Range("A3000").End(xlUp)

If myRng6 = 0 Then
MsgBox "Retail hasn't run"
Else: 'MsgBox "Has Run"
End If

End Sub


The TEST sheet is where the raw data is pasted into. Column C is the
year and column B is the month. J1 is the Year and K1 is the month, I
want to display the latest month.

I have the error with line:
Selection.AutoFilter Field:=2, Criteria1:=DistributionPath2,
Operator:=xlAnd

"Autofilter method of range class failed".

Thanks for how I can solve this.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error with automated execution John Microsoft ADO .NET 5 25th Oct 2004 10:19 PM
Error with automated execution John Microsoft VB .NET 5 25th Oct 2004 09:17 PM
Automated Email error =?Utf-8?B?cXVlc3R5?= Microsoft Outlook Discussion 1 6th Sep 2004 03:23 AM
How to perform an automated AutoFilter sort Jeff Smith Microsoft Excel Worksheet Functions 9 31st Aug 2004 07:17 PM
automated ftp error Aliyah Microsoft Windows 2000 CMD Promt 0 29th Jan 2004 09:21 AM


Features
 

Advertising
 

Newsgroups
 


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