+ Reply to Thread
Results 1 to 2 of 2

Macro Filter Active Range

Hybrid View

ebbo Macro Filter Active Range 03-18-2010, 06:15 AM
Domski Re: Macro Filter Active Range 03-18-2010, 07:42 AM
  1. #1
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    Macro Filter Active Range

    Hello,

    I need help to adjust the following macro so that its dynamically selects the range rather then having fixed numbers

    Sub Macro4()
        Range("A2").Select
        Range("A1:C30131").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
            Sheets("Sheet3").Range("A1:A144"), Unique:=False
    End Sub
    So A1:C30131 could be anything
    and A1:A144 could also be anything

    I need the macro to detect the active range and filter based on range. Does this make sense?

    Thanks

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro Filter Active Range

    Try:

    Sub Macro4()
        Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
            Sheets("Sheet3").Range("A1").CurrentRegion, Unique:=False
    End Sub

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1