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: 20
Default Problem with a macro finding cell values

I'm having an issue with the macro code below. Basically it's looking for a
value in one worksheet and then assigning that value to a variable called
"Item." Then it looks in another worksheet for the value. If it doesn't find
it it goes back to the first sheet and highlights it. The problem I'm running
into is that the same value can be in the first worksheet more than once.
It's not highlighting the first instance of the value but it is highlighting
every instance after it, which I don't want it to do. Any ideas?

With Sheets("Kits").Range("C1:C150000")
Set Rng = .Find(What:=Item, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)

If Not Rng Is Nothing Then
ActiveCell.Offset(1, 0).Activate
Item = ActiveCell.Value
Else
With Selection.Interior
.Pattern = x1Solid
.PatternColorIndex = x1Automatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.Offset(1, 0).Activate
Item = ActiveCell.Value
End If
End With

 
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
Finding Values in a cell Malik Excel Discussion (Misc queries) 3 April 3rd 08 09:13 PM
Finding a cell given x and y values farful[_2_] Excel Programming 1 July 12th 06 07:37 PM
Problem with file finding macro Alf[_8_] Excel Programming 6 June 11th 06 10:04 PM
finding cell values mellowe Excel Discussion (Misc queries) 2 October 20th 05 09:08 PM
Problem finding duplicate values nicoll Excel Programming 1 September 28th 03 10:46 PM


All times are GMT +1. The time now is 03:10 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"