Y
Y
Yuri Chudnovsky2016-04-08 14:36:49
Macros
Yuri Chudnovsky, 2016-04-08 14:36:49

How does Selection.AutoFilter work?

There is an Excel sheet:
A | b | c | D ...
<table header>
numbers | Value# | empty | Surnames | ...
There is such a shitty macro code:

Sub Id_obj()
    Sheets("Лист1").Select
    Application.ScreenUpdating = False
    Dim Balon As Integer
    Balon = Sheets("Лист1").Range("CF6")
    Select Case Balon
            Case 1
                 Selection.AutoFilter Field:=1, Criteria1:="Значение1"
                 Selection.AutoFilter Field:=3, Criteria1:="<>"
            Case 2
                 Selection.AutoFilter Field:=1, Criteria1:="Значение2"
                 Selection.AutoFilter Field:=3, Criteria1:="<>"
...

I don’t understand at all how and why it works in one file (hides lines with empty values ​​in column D and leaves only the value specified in CF6 in column B) and does not work (hides all lines) in another similar one (which is broken).
What specifically I don't understand:
1) Which cells are selected by Selection.AutoFilter?
2) as I understand everything else grows from the first :)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question