Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro which does the does the opposite of what I want. It
deletes all the rows that contains MZ in the first column and leaves everything behing. I just want to keep the rows that contain MZ in the first column and delete all the others rows. Any help will be greatly appreciated. Here is what I have; Sub Delete_Row() Dim myWord As String myWord = "MZ" With ActiveSheet On Error Resume Next Do .Cells.Find(What:="MZ", After:=.Cells(.Cells.Count), _ LookIn:=xlFormulas, Lookat:=xlPart, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=True).EntireRow.Delete If Err.Number < 0 Then Exit Do Loop On Error GoTo 0 End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Marco to Delete Worksheets | Excel Discussion (Misc queries) | |||
marco to delete rows | Excel Discussion (Misc queries) | |||
DELETE ROWS FROM XLS IF THE ROW CONTAINS THE STRING | Excel Discussion (Misc queries) | |||
How to write a marco in Excel to delete worksheet? | Excel Programming | |||
A Marco Delete Question | Excel Programming |