vendredi 8 mai 2015

Filtering based on text in cell

I want to filter a corresponding fiekd for >0 based off the text in cell B1, then copy the filtered information. I'm entry level, so please forgive my experience. I will copy and paste this code and edit the "Field=" and Range("A17:G43") values for about 12 different values in "B1"

If ActiveSheet.Range("B1").Value = "Sch A" Then
    ActiveSheet.Range("$A$17:$CI$43").AutoFilter Field:=7, Criteria1:=">0", _
        Operator:=xlAnd
    Range("A17:G43").Select
    Selection.Copy
ElseIf ActiveSheet.Range("B1").Value = "A-2010" Then
    ActiveSheet.Range("$A$17:$CI$43").AutoFilter Field:=15, Criteria1:=">0", _
        Operator:=xlAnd
    Range("I17:O38").Select
    Selection.Copy
End If

I also want to write something to undo this sorting as a separate code. I will cross the bridge when I get there unless you have a simple solution.

Thank you!

Aucun commentaire:

Enregistrer un commentaire