Filtering depending on value of a cell

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
 
W

Wigi

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
 
K

Khalil Handal

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
 
D

Dave Peterson

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
 
K

Khalil Handal

Thanks Dave. It worked fine.
I also find something at Debra's website that also helped .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top