Filtering depending on value of a cell

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Hi to all,
Is it possible to filtration according to a value that is typed in a certain
cell?

Colomn B contain month names: Jan, Feb, ... until Dec. Is it possible to
filltering using VB Code or Macro.. depending on the value that I type in
cell C4?
After that to print the filtered range starting colomn C until colomn L
after hiding colomns F,G,H,I . Colomn headings are in row 6
 
Yes, you can program the Autofilter.

Have a look in the newsgroups here, that kind of question has been answered
a lot of times of before.

You can reference the value of a cell using:

Sheets("nameofthesheet").Range("thecelladdress").Value
 
Can you specify a reference please??



Wigi said:
Yes, you can program the Autofilter.

Have a look in the newsgroups here, that kind of question has been
answered
a lot of times of before.

You can reference the value of a cell using:

Sheets("nameofthesheet").Range("thecelladdress").Value
 
Try recording a macro when you filter by any value--say ASDF.

Then change that ASDF to the cell that contains your string.

Selection.AutoFilter Field:=1, Criteria1:="=asdf", Operator:=xlAnd
becomes
Selection.AutoFilter Field:=1, _
Criteria1:=worksheets("Sheet9999").range("a1").value

I'd use:
activesheet.autofilter.range.AutoFilter Field:=1, _
Criteria1:=worksheets("Sheet9999").range("a1").value
 
Thanks Dave. It worked fine.
I also find something at Debra's website that also helped .
 
Back
Top