Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
How can I search for a string (Draft Documents) in sheet1 and then delete
all the rows above the row containing the string and then delete the last two rows in sheet1? Thank you |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Try;
Sub DoIt() Dim rRange As Range On Error Resume Next Set rRange = Range(Cells(1, 1). _ Cells.Find("Draft Documents", _ Cells(1, 1), xlFormulas, _ xlWhole, xlByRows, xlNext, False)) On Error GoTo 0 If Not rRange Is Nothing Then rRange.EntireRow.Delete Else MsgBox "'Draft Documents' Not found" End If Set rRange = Cells.Find("*", _ Cells(1, 1), xlFormulas, _ xlPart, xlByRows, xlPrevious, False) rRange.Offset(-2, 0).Range("A1:A2").EntireRow.Delete End Sub -- Regards Dave Hawley www.ozgrid.com "santana" wrote in message ... How can I search for a string (Draft Documents) in sheet1 and then delete all the rows above the row containing the string and then delete the last two rows in sheet1? Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search for string containing | Excel Discussion (Misc queries) | |||
Search for a text string | Excel Discussion (Misc queries) | |||
How to search a string from the right ? | Setting up and Configuration of Excel | |||
to search for a string and affect data if it finds the string? | Excel Worksheet Functions | |||
Q: search in string | Excel Discussion (Misc queries) |