Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default trying to highlight records with at least 3 same value

Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.

Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?

Any help will be appreciated!
Bye,
Stefano.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default trying to highlight records with at least 3 same value

EXACTLY 3 of the same value? Or 3 or more? What columns are involved? Is
there a column that would always have an entry in it for any row with any
data in it? If so, which column would that be?

I've assumed column A will always have an entry on any row with any entries
in it, and that you want to cells shaded yellow, and that you want to do all
of this when the match count is 3 or more.

To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to open
the VB Editor and then choose Insert--Module and copy the code below and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier) or
from the [Developer] tab in Excel 2007.

Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String

lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub


"Stefano" wrote:

Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.

Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?

Any help will be appreciated!
Bye,
Stefano.
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default trying to highlight records with at least 3 same value

On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are involved? Is
there a column that would always have an entry in it for any row with any
data in it? If so, which column would that be?

I've assumed column A will always have an entry on any row with any entries
in it, and that you want to cells shaded yellow, and that you want to do all
of this when the match count is 3 or more.

To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to open
the VB Editor and then choose Insert--Module and copy the code below and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier) or
from the [Developer] tab in Excel 2007.

Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String

lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub

"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!

that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------

the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.

P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want

Thank you very much indeed for your help, i really appreciate that
Stefano.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default trying to highlight records with at least 3 same value

sub colormatchingrowsSAS()
for i = 4 to 44 'rows to check
if cells(i,1)=cells(i+1,1) and _
cells(i,2)=cells(i+2,1) and +
cells(i,3)=cells(i+3,1) then
cells(i,1).resize(,3).interior.colorindex=6
end if
next i
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefano" wrote in message
...
On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are involved?
Is
there a column that would always have an entry in it for any row with any
data in it? If so, which column would that be?

I've assumed column A will always have an entry on any row with any
entries
in it, and that you want to cells shaded yellow, and that you want to do
all
of this when the match count is 3 or more.

To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to
open
the VB Editor and then choose Insert--Module and copy the code below and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on
and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier) or
from the [Developer] tab in Excel 2007.

Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String

lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub

"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!

that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------

the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.

P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want

Thank you very much indeed for your help, i really appreciate that
Stefano.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default trying to highlight records with at least 3 same value

typo
sub colormatchingrowsSAS()
for i = 4 to 44 'rows to check
if cells(i,1)=cells(i+1,1) and _ 'space between d and _
cells(i,2)=cells(i+2,1) and _
cells(i,3)=cells(i+3,1) then
cells(i,1).resize(,3).interior.colorindex=6
end if
next i
end sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
sub colormatchingrowsSAS()
for i = 4 to 44 'rows to check
if cells(i,1)=cells(i+1,1) and _
cells(i,2)=cells(i+2,1) and +
cells(i,3)=cells(i+3,1) then
cells(i,1).resize(,3).interior.colorindex=6
end if
next i
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefano" wrote in message
...
On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are involved?
Is
there a column that would always have an entry in it for any row with
any
data in it? If so, which column would that be?

I've assumed column A will always have an entry on any row with any
entries
in it, and that you want to cells shaded yellow, and that you want to do
all
of this when the match count is 3 or more.

To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to
open
the VB Editor and then choose Insert--Module and copy the code below
and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on
and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier)
or
from the [Developer] tab in Excel 2007.

Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String

lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub

"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.

Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?

Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!

that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------

the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.

P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want

Thank you very much indeed for your help, i really appreciate that
Stefano.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default trying to highlight records with at least 3 same value

You can give this a try. Select one or more columns of cells covering the
rows you want to apply the macro to and then run this macro...

Sub HighlightTriplets()
Dim R As Range, B As Long, E As Long
B = Selection(1).Row 'row number of first row in Selection
E = Selection(Selection.Count).Row 'row number of last row in Selection
For Each R In Selection.Rows
If Evaluate("=SUMPRODUCT(($A$" & B & ":$A$" & E & "&""/""&$B$" & B & _
":$B$" & E & "&""/""&" & "$D$" & B & ":$D$" & E & "=$A" & _
R.Row & "&""/""&$B" & R.Row & "&""/""&$D" & R.Row & _
")*($A$" & B & ":$A$" & E & "&$B$" & B & ":$B$" & E & _
"&$D$" & B & ":$D$" & E & "<""""))=3") Then
R.EntireRow.Interior.ColorIndex = 6
End If
Next
End Sub

A note about the selection method. Let's say you want to run the macro
against rows 4 through 30... you could select the entire rows 4:30, or you
could select A4:A30, or you could select C4:F30, etc. The actual cells you
select doesn't matter just as long as they cover the range of rows you want
to apply the macro to.

--
Rick (MVP - Excel)



"Stefano" wrote in message
...
On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are involved?
Is
there a column that would always have an entry in it for any row with any
data in it? If so, which column would that be?

I've assumed column A will always have an entry on any row with any
entries
in it, and that you want to cells shaded yellow, and that you want to do
all
of this when the match count is 3 or more.

To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to
open
the VB Editor and then choose Insert--Module and copy the code below and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on
and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier) or
from the [Developer] tab in Excel 2007.

Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String

lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub

"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!

that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------

the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.

P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want

Thank you very much indeed for your help, i really appreciate that
Stefano.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default trying to highlight records with at least 3 same value

Sorry, I just coded what you wrote ... "I'm really driving mad to find out a
way to highlight any row in my worksheet that has 3 same value."

At the time you didn't specify within any selection or range of rows, nor
any other requirement, so it does as requested, other than using a total of 3
or more rather than just 3 exactly.

Hopefully, one of the other offers of help hits the mark closer.


"Stefano" wrote:

On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are involved? Is
there a column that would always have an entry in it for any row with any
data in it? If so, which column would that be?

I've assumed column A will always have an entry on any row with any entries
in it, and that you want to cells shaded yellow, and that you want to do all
of this when the match count is 3 or more.

To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to open
the VB Editor and then choose Insert--Module and copy the code below and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier) or
from the [Developer] tab in Excel 2007.

Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String

lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub

"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!

that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------

the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.

P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want

Thank you very much indeed for your help, i really appreciate that
Stefano.
.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default trying to highlight records with at least 3 same value

On Apr 5, 4:00 pm, JLatham wrote:
Sorry, I just coded what you wrote ... "I'm really driving mad to find out a
way to highlight any row in my worksheet that has 3 same value."

At the time you didn't specify within any selection or range of rows, nor
any other requirement, so it does as requested, other than using a total of 3
or more rather than just 3 exactly.

Hopefully, one of the other offers of help hits the mark closer.

"Stefano" wrote:
On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are involved? Is
there a column that would always have an entry in it for any row with any
data in it? If so, which column would that be?


I've assumed column A will always have an entry on any row with any entries
in it, and that you want to cells shaded yellow, and that you want to do all
of this when the match count is 3 or more.


To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11] to open
the VB Editor and then choose Insert--Module and copy the code below and
paste it into the module presented to you. Make any edits needed to the
code. Close the VB Editor. Select the sheet you want this to work on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 & earlier) or
from the [Developer] tab in Excel 2007.


Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String


lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub


"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!


that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------


the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.


P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want


Thank you very much indeed for your help, i really appreciate that
Stefano.
.


@Don Guillett
I tried your code, but it does not seem to work...as expected
Please let me know more info about that
My needs is always the same:
highlight a row with at least three matching value
Thanks for your help!

@Rick Rothstein
your code looks like very handy to me, because it has the option to
choose only the rows I want to check
But...I can't make it works properly
Please, Let me know more about it!
Thanks to you too!

Stefano.
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default trying to highlight records with at least 3 same value

@Rick Rothstein
your code looks like very handy to me, because it has the option to
choose only the rows I want to check
But...I can't make it works properly
Please, Let me know more about it!


I may have misunderstood what you are looking to do. I took your example as
gospel and code my macro to look **only** in Columns A, B and D, but in
re-reading your original message, I'm not so sure you want the columns being
looked at so restricted. Can you clarify exactly what is to be searched? If
not just Columns A, B and D, but rather all columns, then is the order of
the items important?

--
Rick (MVP - Excel)



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default trying to highlight records with at least 3 same value

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefano" wrote in message
...
On Apr 5, 4:00 pm, JLatham wrote:
Sorry, I just coded what you wrote ... "I'm really driving mad to find
out a
way to highlight any row in my worksheet that has 3 same value."

At the time you didn't specify within any selection or range of rows, nor
any other requirement, so it does as requested, other than using a total
of 3
or more rather than just 3 exactly.

Hopefully, one of the other offers of help hits the mark closer.

"Stefano" wrote:
On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are
involved? Is
there a column that would always have an entry in it for any row with
any
data in it? If so, which column would that be?


I've assumed column A will always have an entry on any row with any
entries
in it, and that you want to cells shaded yellow, and that you want to
do all
of this when the match count is 3 or more.


To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11]
to open
the VB Editor and then choose Insert--Module and copy the code below
and
paste it into the module presented to you. Make any edits needed to
the
code. Close the VB Editor. Select the sheet you want this to work
on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 &
earlier) or
from the [Developer] tab in Excel 2007.


Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String


lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub


"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish
that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!


that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------


the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.


P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want


Thank you very much indeed for your help, i really appreciate that
Stefano.
.


@Don Guillett
I tried your code, but it does not seem to work...as expected
Please let me know more info about that
My needs is always the same:
highlight a row with at least three matching value
Thanks for your help!

@Rick Rothstein
your code looks like very handy to me, because it has the option to
choose only the rows I want to check
But...I can't make it works properly
Please, Let me know more about it!
Thanks to you too!

Stefano.


  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default trying to highlight records with at least 3 same value

On Apr 6, 8:50 pm, "Don Guillett" wrote:
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Stefano" wrote in message

...

On Apr 5, 4:00 pm, JLatham wrote:
Sorry, I just coded what you wrote ... "I'm really driving mad to find
out a
way to highlight any row in my worksheet that has 3 same value."


At the time you didn't specify within any selection or range of rows, nor
any other requirement, so it does as requested, other than using a total
of 3
or more rather than just 3 exactly.


Hopefully, one of the other offers of help hits the mark closer.


"Stefano" wrote:
On Apr 4, 7:45 pm, JLatham wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are
involved? Is
there a column that would always have an entry in it for any row with
any
data in it? If so, which column would that be?


I've assumed column A will always have an entry on any row with any
entries
in it, and that you want to cells shaded yellow, and that you want to
do all
of this when the match count is 3 or more.


To check out the code:
Make a copy of your workbook. With the copy open, press [Alt]+[F11]
to open
the VB Editor and then choose Insert--Module and copy the code below
and
paste it into the module presented to you. Make any edits needed to
the
code. Close the VB Editor. Select the sheet you want this to work
on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 &
earlier) or
from the [Developer] tab in Excel 2007.


Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String


lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub


"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to accomplish
that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!


that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5 900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------


the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.


P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I want


Thank you very much indeed for your help, i really appreciate that
Stefano.
.


@Don Guillett
I tried your code, but it does not seem to work...as expected
Please let me know more info about that
My needs is always the same:
highlight a row with at least three matching value
Thanks for your help!


@Rick Rothstein
your code looks like very handy to me, because it has the option to
choose only the rows I want to check
But...I can't make it works properly
Please, Let me know more about it!
Thanks to you too!


Stefano.


@Rick Rothstein
just column A B D. Order is not important
Thanks, Stefano.
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default trying to highlight records with at least 3 same value



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefano" wrote in message
...
On Apr 6, 8:50 pm, "Don Guillett" wrote:
If desired, send your file to my address below. I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Stefano" wrote in message

...

On Apr 5, 4:00 pm, JLatham wrote:
Sorry, I just coded what you wrote ... "I'm really driving mad to find
out a
way to highlight any row in my worksheet that has 3 same value."


At the time you didn't specify within any selection or range of rows,
nor
any other requirement, so it does as requested, other than using a
total
of 3
or more rather than just 3 exactly.


Hopefully, one of the other offers of help hits the mark closer.


"Stefano" wrote:
On Apr 4, 7:45 pm, JLatham
wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are
involved? Is
there a column that would always have an entry in it for any row
with
any
data in it? If so, which column would that be?


I've assumed column A will always have an entry on any row with
any
entries
in it, and that you want to cells shaded yellow, and that you want
to
do all
of this when the match count is 3 or more.


To check out the code:
Make a copy of your workbook. With the copy open, press
[Alt]+[F11]
to open
the VB Editor and then choose Insert--Module and copy the code
below
and
paste it into the module presented to you. Make any edits needed
to
the
code. Close the VB Editor. Select the sheet you want this to
work
on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 &
earlier) or
from the [Developer] tab in Excel 2007.


Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String


lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub


"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in
my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to
accomplish
that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!


that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5
900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------


the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.


P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I
want


Thank you very much indeed for your help, i really appreciate that
Stefano.
.


@Don Guillett
I tried your code, but it does not seem to work...as expected
Please let me know more info about that
My needs is always the same:
highlight a row with at least three matching value
Thanks for your help!


@Rick Rothstein
your code looks like very handy to me, because it has the option to
choose only the rows I want to check
But...I can't make it works properly
Please, Let me know more about it!
Thanks to you too!


Stefano.


@Rick Rothstein
just column A B D. Order is not important
Thanks, Stefano.


  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default trying to highlight records with at least 3 same value

If I understand correctly, you can just change my code to look at column 4
instead of column3
sub colormatchingrowsSAS()
for i = 4 to 44 'rows to check
if cells(i,1)=cells(i+1,1) and _
cells(i,2)=cells(i+2,1) and _
cells(i,4)=cells(i+4,1) then
cells(i,1).resize(,4).interior.colorindex=6
end if
next i
end sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefano" wrote in message
...
On Apr 6, 8:50 pm, "Don Guillett" wrote:
If desired, send your file to my address below. I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Stefano" wrote in message

...

On Apr 5, 4:00 pm, JLatham wrote:
Sorry, I just coded what you wrote ... "I'm really driving mad to find
out a
way to highlight any row in my worksheet that has 3 same value."


At the time you didn't specify within any selection or range of rows,
nor
any other requirement, so it does as requested, other than using a
total
of 3
or more rather than just 3 exactly.


Hopefully, one of the other offers of help hits the mark closer.


"Stefano" wrote:
On Apr 4, 7:45 pm, JLatham
wrote:
EXACTLY 3 of the same value? Or 3 or more? What columns are
involved? Is
there a column that would always have an entry in it for any row
with
any
data in it? If so, which column would that be?


I've assumed column A will always have an entry on any row with
any
entries
in it, and that you want to cells shaded yellow, and that you want
to
do all
of this when the match count is 3 or more.


To check out the code:
Make a copy of your workbook. With the copy open, press
[Alt]+[F11]
to open
the VB Editor and then choose Insert--Module and copy the code
below
and
paste it into the module presented to you. Make any edits needed
to
the
code. Close the VB Editor. Select the sheet you want this to
work
on and
[Run] the macro from Tools -- Macro -- Macros (Excel 2003 &
earlier) or
from the [Developer] tab in Excel 2007.


Sub MarkRows()
'works with the selected sheet
'the next Const identifies the
'column that will always have
'some entry in it on every row used
'change as required
Const keyCol = "A"
Dim lastRow As Long
Dim lastColAddr As String
Dim testRange As Range
Dim anyTestCell As Range
Dim matchCount As Double
Dim LC As Integer
Dim testCells As String
Dim matchCell As String


lastRow = Range(keyCol & Rows.Count).End(xlUp).Row
'change "1:" to "2:" if you have labels in row 1
Set testRange = Range(keyCol & "1:" & _
keyCol & lastRow)
Application.ScreenUpdating = False
For Each anyTestCell In testRange
anyTestCell.EntireRow.Interior.ColorIndex = xlNone
lastColAddr = anyTestCell.Offset(0, Columns.Count - _
anyTestCell.Column).End(xlToLeft).Address
matchCount = 0 ' reset
If Range(lastColAddr).Column 2 Then
For LC = 1 To Range(lastColAddr).Column
testCells = "A" & anyTestCell.Row & ":" & _
lastColAddr
matchCell = Cells(anyTestCell.Row, LC).Address
matchCount = _
WorksheetFunction.CountIf(Range(testCells), _
Range(matchCell))
If matchCount = 3 Then
Exit For
End If
Next
End If
If matchCount = 3 Then
anyTestCell.EntireRow.Interior.ColorIndex = 6 ' yellow
End If
Next
Set testRange = Nothing
End Sub


"Stefano" wrote:
Hi to everyone in this forum!
I'm really driving mad to find out a way to highlight any row in
my
worksheet that has 3 same value.
A value can be both numbers or text.


Does anyone to know how to write a piece of VB code to
accomplish
that
job with Excel 2003?


Any help will be appreciated!
Bye,
Stefano.
.


@Don Guillett and @JLatham
thanks both of you for the reply!


that's an example to you:
---------------------------------------------------------------------------------------------------------
A B D
--------------------------------------
John 3 100,50
--------------------------------------
John 3 100,50 -----------------------------------
(that's a duplicate and it has to be yellow highlighted)
--------------------------------------
John 3 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
John 5 200,70 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------
Carl 5
900,20 -----------------------------------
(that's NOT a duplicate, because column C has a different value)
--------------------------------------


the very last thing is:
it will be great if I could run the macro only on selected rows and
not to all the worksheet.


P.S.
@JLatham
I fired your code it's work but it's not seem to highlight what I
want


Thank you very much indeed for your help, i really appreciate that
Stefano.
.


@Don Guillett
I tried your code, but it does not seem to work...as expected
Please let me know more info about that
My needs is always the same:
highlight a row with at least three matching value
Thanks for your help!


@Rick Rothstein
your code looks like very handy to me, because it has the option to
choose only the rows I want to check
But...I can't make it works properly
Please, Let me know more about it!
Thanks to you too!


Stefano.


@Rick Rothstein
just column A B D. Order is not important
Thanks, Stefano.


  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default trying to highlight records with at least 3 same value

@Rick Rothstein
just column A B D. Order is not important


If by that you mean this...

A B D
=== === ===
Rick Stefano Don

matches this....

A B D
=== === ===
Don Stefano Rick

then my posted code will not work for you.

--
Rick (MVP - Excel)


  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default trying to highlight records with at least 3 same value

On Apr 6, 10:22 pm, "Rick Rothstein"
wrote:
@Rick Rothstein
just column A B D. Order is not important


If by that you mean this...

A B D
=== === ===
Rick Stefano Don

matches this....

A B D
=== === ===
Don Stefano Rick

then my posted code will not work for you.

--
Rick (MVP - Excel)


@Rick Rothstein
no...I'll always have "Rick"at A column.... but it still does not seem
to work...why?
Please let me know more...
I mean, if I start a new sheet and I write Rick, Stefano, Don,
respectively into column A, B, D, and i run the macro nothing became
highlighted...?
What I'm doing wrong?

Thank you very much indeed,
Stefano.
  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default trying to highlight records with at least 3 same value

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefano" wrote in message
...
On Apr 6, 10:22 pm, "Rick Rothstein"
wrote:
@Rick Rothstein
just column A B D. Order is not important


If by that you mean this...

A B D
=== === ===
Rick Stefano Don

matches this....

A B D
=== === ===
Don Stefano Rick

then my posted code will not work for you.

--
Rick (MVP - Excel)


@Rick Rothstein
no...I'll always have "Rick"at A column.... but it still does not seem
to work...why?
Please let me know more...
I mean, if I start a new sheet and I write Rick, Stefano, Don,
respectively into column A, B, D, and i run the macro nothing became
highlighted...?
What I'm doing wrong?

Thank you very much indeed,
Stefano.


  #18   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default trying to highlight records with at least 3 same value

I'm not sure what to tell you... if we are looking in Columns A, B and D for
identical content in each of the cells for a given column occurring 3 or
more time, then the code I posted works fine in my tests. Are you
remembering to select a range whose rows cover the rows you want to test for
your triples? You can send your workbook to me if you want and I would be
happy to look and see why you are having trouble with my code.... just
remove the NO.SPAM stuff from my email address.

--
Rick (MVP - Excel)



"Stefano" wrote in message
...
On Apr 6, 10:22 pm, "Rick Rothstein"
wrote:
@Rick Rothstein
just column A B D. Order is not important


If by that you mean this...

A B D
=== === ===
Rick Stefano Don

matches this....

A B D
=== === ===
Don Stefano Rick

then my posted code will not work for you.

--
Rick (MVP - Excel)


@Rick Rothstein
no...I'll always have "Rick"at A column.... but it still does not seem
to work...why?
Please let me know more...
I mean, if I start a new sheet and I write Rick, Stefano, Don,
respectively into column A, B, D, and i run the macro nothing became
highlighted...?
What I'm doing wrong?

Thank you very much indeed,
Stefano.


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
Delete records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
highlight records on experation date( Excel 2003) micky57 Excel Discussion (Misc queries) 1 January 15th 09 01:25 PM
how to highlight more related cells if cell highlight Jon Excel Discussion (Misc queries) 5 December 21st 08 01:06 PM
draw 999 x 8 random records from file with 8614 records news.wanadoo.nl Excel Programming 1 March 1st 06 03:04 PM
Highlight cells with ctrl-click but only un-highlight one cell hagan Excel Discussion (Misc queries) 5 May 27th 05 06:45 PM


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

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"