View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Cheekyaardvark Cheekyaardvark is offline
external usenet poster
 
Posts: 10
Default Macro to Filter on active cell within autofilter

Thanks Bernie

Does this macro define the current cell as the active cell... the macro
only works the first time & seems to capture the value of that first
run for it to do subsequent filters on... for example if I run this on
a cell with 0.00 value & then move to a different column it attempts to
filter on 0.00 not the new active cell
What I was trying to get to was a position where I can filter on a
value in one column & then move to another column & further filter on
that to "home in" on fewer & fewer rows,
I want to run subsequent runs of the same macro but with the criteria
defined in the active cell

Thanks again for the assistance...

Robin


Bernie Deitrick wrote:
Robin,

This is written with the assumption that you have only one contiguous data table filtered:

Sub FilterBasedOnActiveCellContents()
ActiveCell.CurrentRegion.AutoFilter _
Field:=ActiveCell.Column - ActiveCell.CurrentRegion.Cells(1).Column + 1, _
Criteria1:=ActiveCell.Value
End Sub

HTH,
Bernie
MS Excel MVP


"Cheekyaardvark" wrote in message
ups.com...
I have a spreadsheet that I already have autofilter activated on, what
I would like to do is have a macro that I can pop on my toolbar that
will filter the file based on the active cell contents, I had a macro
that did this in previous verison of excel but I somehow lost it during
migration to excel 2003 & cannot recreate it


Can anybody guide me on this

Appreciate it

Robin