I searched many sites and used codes which delete Rows based on criteria. In my case those codes works, BUT it took so much time about 30 min since there is about 75 thsd rows, and that solution in not time saver.
I recorded code below and it is done in seconds. I need help to make it dynamic, VBA, since number of rows is every month larger.
Basicly, I need code which delete rows based on Column B, where walue is "R"
thx in advance
I recorded code below and it is done in seconds. I need help to make it dynamic, VBA, since number of rows is every month larger.
Basicly, I need code which delete rows based on Column B, where walue is "R"
thx in advance
Code:
Sub DelRowsBasedOnOneCriteria()
'
' DelRowsBasedOnOneCriteria Macro
'
'
ActiveSheet.Range("$A$1:$R$74478").AutoFilter Field:=2, Criteria1:="R"
Rows("8733:8733").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("B1").Select
ActiveSheet.ShowAllData
Cells.Select
ActiveWorkbook.Worksheets("MySheet").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("MySheet").Sort.SortFields.Add Key:=Range( _
"A2:A74478"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("MySheet").Sort
.SetRange Range("A1:R74478")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B4").Select
End Sub