Answer the question
In order to leave comments, you need to log in
How to read updated cell values after applying a filter in VBA?
In column B I have 1000 values. Also manually made a filter that filters the amount by month. There is code that counts the number:
Sub flight_plot()
one = 0
For Each c in ActiveWorkbook.Worksheets("Account").Range("b8:b1000)
If c= "something" Then
one = one + 1
End if
Next
However when I apply the filter and the quantity changes, the macro reads the previous quantity.
Answer the question
In order to leave comments, you need to log in
Add this line to the condition:
Your code is slightly modified: several numbers in a column, only "5" values are filtered
Sub filter()
Dim one As Integer
Dim c As Variant
one = 0
For Each c In ActiveWorkbook.Worksheets("Лист1").Range("C6:C19")
If (c <> "") And (Rows(c.Row).Hidden = False) Then
one = one + Int(c)
End If
Next
MsgBox (Str(one))
End Sub
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question