Thread: VB Help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stan Stan is offline
external usenet poster
 
Posts: 150
Default VB Help

I'm new to coding so any help you could provide would be greatly appreciated.

I'm wanting to find rows in a spreadsheet that contains the words "Use Start".

If found, I need to find rows above the found text that include the text
"Mgr." and "Agent" and below the text that includes "Mon1",
"Tue1",....."Sat1".

Then loop the code to continue to find all the rows that include "Use Start"
and the rows above and below that have Mgr., Agent, Mon1, Tue1,....Sat1.

All other rows in the spreadsheet would be deleted.

Here is some code that I started on to find rows that include "Use Start"
but it doesn't work.

Sub cleanup2()
Dim rng As Range
Set rng = Range("A:A").Find(What:="Use Start", After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

If rng Is Nothing Then
Do
Row.Delete

Loop While rng Is Nothing
End If

End Sub