View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Neal Zimm Neal Zimm is offline
external usenet poster
 
Posts: 345
Default Two Ranges, Spot Different Values

I have two ranges in the same sheet where I want to know
if a cell's value is different between the "original" and the copy.
The "in development" code below works but takes more than
a few seconds to run.

I'll be working thru ignoring some cells with formulas.
I will be able to get the row/col values for the two ranges
with their begining/ending row/col numbers.

I'm not yet familiar with 'specialcells' functions.

Can someone start me off with a more object oriented
approach to comparing values between two ranges having
exactly the same "shape" ?

Thanks. Neal Z

EndRow = 1847 'first range
OffSet = 1000 'copied range is 1000 rows below end of 1st range.
With Ws
For Row = 1 To EndRow '2847 1st row of copy
CheckRow = Row + EndRow + OffSet - 1
For Col = 5 To 100
'ignore cells with =row formulas as diff 'copy' row values do not
matter.
If InStr(.Cells(Row, Col).Formula, "=ROW") < 1 Then

If .Cells(Row, Col).Value < .Cells(CheckRow, Col).Value Then
TextA = .Cells(Row, Col).Value & " at row/col " _
& Row & "/" & Col & vbCr & .Cells(CheckRow, Col).Value _
& " at row " & CheckRow
Debug.Print TextA
Exit Sub
End If

End If
Next Col
Next Row
End With

--
Neal Z