Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created July 22, 2017 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/ab26003ee9e4d08f8cc175a1646de339 to your computer and use it in GitHub Desktop.
Save ndthanh/ab26003ee9e4d08f8cc175a1646de339 to your computer and use it in GitHub Desktop.
Sub DeleteRows()
'Updateby20140314
Dim rng As Range
Dim InputRng As Range
Dim DeleteRng As Range
Dim DeleteStr As String
xTitleId = "Hoc Excel Online"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
DeleteStr = Application.InputBox("Delete Text", xTitleId, Type:=2)
For Each rng In InputRng
If rng.Value = DeleteStr Then
If DeleteRng Is Nothing Then
Set DeleteRng = rng
Else
Set DeleteRng = Application.Union(DeleteRng, rng)
End If
End If
Next
DeleteRng.EntireRow.Delete
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment