hi guys,
I have inherited a VBA script which takes a worksheet (44K rows) and as part of its validation checks to see if an asset ID appears on more than one row using the countif function
Originally it was deleting the line as it went through the loop. I have changed this to setting a value and then at the end of the loop autofiltering on the value and deleting the lines on masse. Is there a more efficient way to check if the assetRef appears more than once?
I am thinking maybe using autofilter and counting the displayed rows but I am struggling to make specialcells(xlCellTypeVisible) play nicely with the other children.
I have inherited a VBA script which takes a worksheet (44K rows) and as part of its validation checks to see if an asset ID appears on more than one row using the countif function
Code:
If Cells(ActiveCell.Row, chChargeGroup) = "RENT" And WorksheetFunction.CountIf(Range(Cells(2, chU001_AssetRef), Cells(LastRow, chU001_AssetRef)), Selection) = 2 Then
Originally it was deleting the line as it went through the loop. I have changed this to setting a value and then at the end of the loop autofiltering on the value and deleting the lines on masse. Is there a more efficient way to check if the assetRef appears more than once?
I am thinking maybe using autofilter and counting the displayed rows but I am struggling to make specialcells(xlCellTypeVisible) play nicely with the other children.