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

Need to find duplicate or double numbers per row. Such as
1 2 3 4 5 5 6 7 in which 5 5 are double numbers in error
highlite 5 5 in color, move on to the next set of error double numbers.
I would like a range of numbers 1 to 70 to be checked at once.
The problem is in "MyValue = 1 to 70"

Sub LookDoubleAgain()
Dim x As Range
' MyValue = Range("A1")
MyValue = CInt(MyValue)
With Sheets("Sheet1")
Set x = .Range(.Range("C2"), .Range("V2201"))
End With
For Each c In x
If c.Value = MyValue Then
If c.Value = c.Offset(0, 1).Value Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
End If
Next
'Range("A1").Select
End Sub

With Thanks
Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Double Numbers

Don't need VBA. Use XL's conditional formatting. Select the entire
range (suppose it is A1:F1), then Format | Conditional Formatting...
From the first drop down box select 'Formula Is' and in the adjacent
textbox enter =COUNTIF($A$1:$F$1,A1)1. Click the Format... button and
set the desired format.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Need to find duplicate or double numbers per row. Such as
1 2 3 4 5 5 6 7 in which 5 5 are double numbers in error
highlite 5 5 in color, move on to the next set of error double numbers.
I would like a range of numbers 1 to 70 to be checked at once.
The problem is in "MyValue = 1 to 70"

Sub LookDoubleAgain()
Dim x As Range
' MyValue = Range("A1")
MyValue = CInt(MyValue)
With Sheets("Sheet1")
Set x = .Range(.Range("C2"), .Range("V2201"))
End With
For Each c In x
If c.Value = MyValue Then
If c.Value = c.Offset(0, 1).Value Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
End If
Next
'Range("A1").Select
End Sub

With Thanks
Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Double Numbers

"smandula" wrote in message
...
Need to find duplicate or double numbers per row. Such as
1 2 3 4 5 5 6 7 in which 5 5 are double numbers in error
highlite 5 5 in color, move on to the next set of error double numbers.
I would like a range of numbers 1 to 70 to be checked at once.
The problem is in "MyValue = 1 to 70"

Sub LookDoubleAgain()
Dim x As Range
' MyValue = Range("A1")
MyValue = CInt(MyValue)
With Sheets("Sheet1")
Set x = .Range(.Range("C2"), .Range("V2201"))
End With
For Each c In x
If c.Value = MyValue Then
If c.Value = c.Offset(0, 1).Value Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
End If
Next
'Range("A1").Select
End Sub


howzabout

for each c in range("A1:G70") 'or whatever range you want to evaluate
if c.value = cells(c.row, c.column+1).value then
do your colour changes
else
next c
end if
end for


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Double Numbers

Looks like I solved the Question myself.
Usefull if you enter the same number twice on the same row.
It's esay to do

Sub LookDoubleAgain()
For Each c In Range("C2:V2201")
If c.Value = Cells(c.Row, c.Column + 1).Value Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
Next
Range("A1").Select
End Sub

Hopes this helps someone!


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
sustain numbers with double quotes driller Excel Discussion (Misc queries) 7 October 10th 09 10:40 AM
How does one double sequential numbers in rows? frenchy Excel Discussion (Misc queries) 1 September 7th 07 09:06 PM
recognizing double digit numbers in code DB Excel Discussion (Misc queries) 3 March 2nd 07 04:43 PM
double axis, double problem (i hope only to me) kitcho Charts and Charting in Excel 1 December 30th 06 12:52 AM
Macro to mark double numbers in another colour. Stevie[_2_] Excel Programming 4 February 11th 04 08:37 PM


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