Hello,
The following code applies a filter in a sheet and it does it right. Then, I apply a FOR and an IF to do some operations. The problem is that the for doesn't take into account the filter and it goes though the whole column instead. Do you know how can I fix this? Thanks!!
The following code applies a filter in a sheet and it does it right. Then, I apply a FOR and an IF to do some operations. The problem is that the for doesn't take into account the filter and it goes though the whole column instead. Do you know how can I fix this? Thanks!!
Code:
ultima_fila = Sheets(celdas).Cells(Rows.Count, "A").End(xlUp).Row
ActiveSheet.Range("$A$1:$AM$" & ultima_fila).AutoFilter Field:=11, Criteria1:="1"
ActiveSheet.Range("$A$1:$AM$" & ultima_fila).AutoFilter Field:=4, Criteria1:=provincia
For i = 2 To ultima_fila
suma_nodo_sampled = 0
suma_nodo_unavail = 0
For j = 2 To ultima_fila_inventario - 1
If Range("S" & i).Value = Workbooks(inv_name).Sheets("Nodos").Range("A" & j).Value Then
suma_nodo_sampled = suma_nodo_sampled + Range("j" & i).Value
suma_nodo_unavail = suma_nodo_unavail + Range("i" & i).Value
End If
Next j
Next i