LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"