If you want to delete a row when the cell value = del in column 1 or A in a sheet
Here is the code --------
change the sheet index and range according to your requirement
Sub find_delete()
Application.ScreenUpdating = False
Dim a As Range
Dim SrchRnga
Set SrchRnga = Sheets(1).Range("a1: a" & ActiveSheet.UsedRange.Rows.Count)
Do
Set a = SrchRnga.Find("del", LookIn:=xlValues)
If Not a Is Nothing Then a.EntireRow.Delete
Loop While Not a Is Nothing
Application.ScreenUpdating = True
End Sub
Mehtod 2
change the sheet index and column number according to your requirement
Sub find_delete1()
Application.ScreenUpdating = False
Dim i As Long
For i = Sheets(1).UsedRange.Rows.Count To 1 Step -1
If Sheets(1).Cells(i, 1).Value = "del" Then
Sheets(1).Cells(i, 1).EntireRow.Delete
End If
Application.ScreenUpdating = True
Next
End Sub
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
If you want to add a new pop up button on mouse right click menu and as soon as you click on it . It shows you multiple buttons with macro a...
-
If you have added the shape in the sheet and now you want to change it color , text , font size ,etc using VBA. Snapshot below Code- Su...
No comments:
Post a Comment