View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default If cell value is the same

Hi CTm

Try this code

Sub Dublets()
Dim StartCell As Range
Dim LastCell As Range
Dim TargetRange As Range
Dim mFormat As Boolean
Dim off As Integer
Dim FormatTest As Boolean

Set LastCell = Cells(Rows.Count, 1).End(xlUp)
Set StartCell = Range("A1")
Set TargetRange = Range(StartCell, LastCell)

off = 1
For Each cell In TargetRange
Do Until LastCell.Row = StartCell.Row + off
If cell.Value = cell.Offset(off, 0).Value Then
If FormatTest = False Then
If cell.Offset(off, 0).Font.Strikethrough = True Then
mFormat = False
Else
mFormat = True
End If
FormatTest = True
End If
cell.Offset(off, 0).Font.Strikethrough = mFormat
End If
off = off + 1
Loop
off = 1
Next
End Sub

Regards,
Per

"Corey ...." skrev i meddelelsen
...
I need a simple code to see if there are any duplicate values in column A
of sheet 1.
I need the code to search fromt he top of the sheet down.
If the first duplicated value is (.font.strikethrough)=True then i need
ALL other values that are duplicated(exactly the same) to be also changed
to .Font.Strikethrough=True.

If the first dulpicated value is NOT .FontStrikethrough then the
remaining duplicate values are to be also Not .Font.Strikethrough.

How would i go about this ?

CTm