Advertisement
YasserKhalil2019

T4005_Delete Rows By Specific Range Union Method

Sep 27th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. https://excel-egy.com/forum/t4005
  2. ---------------------------------
  3.  
  4. Sub Delete_Rows_By_Specific_Range_Union_Method()
  5. Dim c As Range, r As Range
  6.  
  7. Application.ScreenUpdating = False
  8. For Each c In Range(Cells(2, 5), Cells(2, Cells(2, Columns.Count).End(xlToLeft).Column))
  9. If IsNumeric(c.Value) Then
  10. If r Is Nothing Then Set r = Range("A" & c.Value) Else Set r = Union(r, Range("A" & c.Value))
  11. End If
  12. Next c
  13.  
  14. If Not r Is Nothing Then r.EntireRow.Delete
  15. Application.ScreenUpdating = True
  16. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement