Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default FIND Command

Hi

Im using the find command and the findnext. It keeps going in a loop
so when it has gone to the bottom of the range it then goes back to
the top. How can i stops this basically i want to look in a column for
cells with PC in and then set the background color of the row

Thanks Neil
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default FIND Command

capture the address of the first find, then test subsequent finds for the
same address



Neil Shaw wrote in message
om...
Hi

Im using the find command and the findnext. It keeps going in a loop
so when it has gone to the bottom of the range it then goes back to
the top. How can i stops this basically i want to look in a column for
cells with PC in and then set the background color of the row

Thanks Neil



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default FIND Command

I am new at this stuff myself but if I understand your
question this might help. It is case sensitive and will
highlight from column A to eterity. I hope you can fix it
right.

Option Explicit

Sub PCYELLOW()

Dim FoundCell As Range
Dim firstAddress As String
Dim myWord As String
Dim YellowCell As Range

myWord = "PC"
With ActiveSheet.Cells
Set FoundCell = Nothing
Set FoundCell = Cells.Find(What:=myWord,
LookAt:=xlWhole, SearchOrder _
:=xlByRows, MatchCase:=True)

If Not FoundCell Is Nothing Then
firstAddress = FoundCell.Address

Do
If YellowCell Is Nothing Then
Set YellowCell = FoundCell
Else: Set YellowCell = Union(FoundCell,
YellowCell)
End If
Set FoundCell = .FindNext(FoundCell)
Loop While Not FoundCell Is Nothing _
And FoundCell.Address < firstAddress
End If
End With

If YellowCell Is Nothing Then Exit Sub
YellowCell.EntireRow.Interior.ColorIndex = 6
YellowCell.EntireRow.Interior.Pattern = xlSolid
End Sub

-----Original Message-----
Hi

Im using the find command and the findnext. It keeps

going in a loop
so when it has gone to the bottom of the range it then

goes back to
the top. How can i stops this basically i want to look in

a column for
cells with PC in and then set the background color of the

row

Thanks Neil
.

Reply
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Command Mike H. Excel Discussion (Misc queries) 8 March 24th 10 10:10 PM
Excel FIND Command KarenH Excel Discussion (Misc queries) 2 December 19th 09 05:47 PM
FIND command Paul Blarmy Excel Discussion (Misc queries) 5 January 6th 07 12:30 PM
Advanced Find Command?? Debbie Excel Discussion (Misc queries) 1 February 4th 05 09:07 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 08:07 AM.

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

About Us

"It's about Microsoft Excel"