Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Filter Macro

"Dennis@Merlin" wrote in message
...
:I have a workbook with multiple worksheets and each WS has a different
number
: of rows. I'm trying to write a single macro that I can use with each WS
: indicidually to filter the data. Here's my code; but I get a Run-time
error
: '1004' ; Method Range of object '_Global' failed on the line before End
Sub.
:
: Sub FilterData()
: Dim MyRange As Range
: Range("E10").Activate
: Set MyRange = Range("E10", Cells(Rows.Count, 5).End(xlUp))
: Range("MyRange").AdvancedFilter Action:=xlFilterInPlace,
: CriteriaRange:=Range("E1:E2"), Unique:=False
: End Sub

I don't think you can Range("MyRange") since it is already a range. Also, I
deleted the activate since typically this is not needed but if you did want
it, then put it back.

Sub FilterData()
Dim MyRange As Range
Set MyRange = Range("E10", Cells(Rows.Count, 5).End(xlUp))
MyRange.AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("E1:E2"), Unique:=False
End Sub


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
Macro Filter Blue Excel Worksheet Functions 2 May 26th 09 08:01 AM
how can this filter be done in a macro? Dave F Excel Discussion (Misc queries) 8 March 2nd 07 09:22 AM
Need macro to filter, create tab on filter and copy/paste Jen[_11_] Excel Programming 1 May 2nd 06 04:45 PM
Need macro to filter, create tab on filter and copy/paste Jen[_11_] Excel Programming 1 May 2nd 06 04:45 PM
Filter in macro POM Excel Programming 4 February 23rd 05 04:25 PM


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

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

About Us

"It's about Microsoft Excel"