D
Dave L
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
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