Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

Apply filter on the second worksheet of the workbook VBA

$
0
0

I already have a filter macro that cleanses the data of the first sheet("RO") of the workbook, now i want to clean the second worksheet ("RSSI"), i thought that by declaring the second sheet as the actual worksheet might work but it still works on the first sheet.

Dim wsToFilter As Worksheet
Dim wbToFilter As Workbook
Set wbToFilter = Workbooks("2. Detalle_Transacciones_pendientes_rechazadas_MDM_27Ene20.xlsx")
Set wsToFilter = wbToFilter.Worksheets("Rechazos_SSI_2019")

Dim RowToTest2 As Long

For RowToTest2 = Cells(Rows.Count, 2).End(xlUp).row To 2 Step -1

With Cells(RowToTest2, 1)
   If .Value <> "BATCH" _
   Then _
   Rows(RowToTest2).EntireRow.Delete
End With

Next RowToTest2

Viewing all articles
Browse latest Browse all 88835


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>