.Range problem

Wicked Mongoose
06-05-2008, 10:34 AM
I am having similar troubles, I want to loop through a range and find discrepencies between two sets of lists.

however I can't get the looping to work.

here is what I have.


Dim i
With ActiveSheet
For i = 1 To 200
If .Range(.Cells(i, 3), .Cells(i, 4)) <> .Range(.Cells(i, 1), .Cells(i, 2)) Then
.Range(.Cells(i, 3), .Cells(i, 4)).Insert Shift:=xlDown
End If
Next i
End With

Colin Legg
06-05-2008, 11:10 AM
Hi Wicked Mongoose and welcome.

It's always a big help to us if you can tell us exactly what the problem is rather than just saying "it doesn't work". ;)
On the surface this looks like a similar problem, but actually the issue is different. This is evidenced by this example:


If Worksheets(1).Range("A1:B1").Value <> Worksheets(1).Range("C1:D1").Value Then
'.....
End If


That also throws out a run-time Type Mismatch error. Any thoughts on why that might be?

Colin

Wicked Mongoose
06-05-2008, 11:53 AM
hmmm... am I even allowed to compare ranges of cells?
maybe if i set it up as a nested if statement.

brb with results.

Wicked Mongoose
06-05-2008, 12:06 PM
It works! Now I can start building the rest of it:D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum