J
Josh heep
Hey,
I was wondering if there is a more efficient way to write this macro.
It searches through a selected range and deletes any row that is
valued as True. I made it to remove duplicates based on various
criteria that I change from project to project. Thanks for any
insight!
Sub Delete_True_Rows_In_Selection()
Dim TotalRows As Integer
Dim FirstRow As Integer
Dim Col As Integer
Dim Row As Integer
TotalRows = Selection.Rows.Count
FirstRow = Selection.Row()
Col = Selection.Column()
Application.ScreenUpdating = False
On Error Resume Next
For Row = FirstRow To TotalRows
If Cells(Row, Col).Value = True Then
Rows(Row).Delete
Row = Row - 1
End If
Next Row
Application.ScreenUpdating = True
End Sub
I was wondering if there is a more efficient way to write this macro.
It searches through a selected range and deletes any row that is
valued as True. I made it to remove duplicates based on various
criteria that I change from project to project. Thanks for any
insight!
Sub Delete_True_Rows_In_Selection()
Dim TotalRows As Integer
Dim FirstRow As Integer
Dim Col As Integer
Dim Row As Integer
TotalRows = Selection.Rows.Count
FirstRow = Selection.Row()
Col = Selection.Column()
Application.ScreenUpdating = False
On Error Resume Next
For Row = FirstRow To TotalRows
If Cells(Row, Col).Value = True Then
Rows(Row).Delete
Row = Row - 1
End If
Next Row
Application.ScreenUpdating = True
End Sub