Hi,
I neede to do something like this : I have two columns A and B:
A B
12 12
13 13
14 15
21 16
21
I need to compare range column "A" with range column "B". If I don't find A into B I'd copy this value into columm "C".
I wrote this , but I ins't work.
Thanks for help
Sub compare()
Dim myrng As Range
Dim myrng1 As Range
Dim cel As Range
Dim cel1 As Range
Set myrng = Plan1.Range("a1:a10"
Set myrng1 = Plan1.Range("b1:b10"
For Each cel In myrng
For Each cel1 In myrng1
If cel.Value <> cel1.Value Then
cel.Selection
Selection.Copy
Columns("c".PasteSpecial
End If
Next
Next
End Sub
I neede to do something like this : I have two columns A and B:
A B
12 12
13 13
14 15
21 16
21
I need to compare range column "A" with range column "B". If I don't find A into B I'd copy this value into columm "C".
I wrote this , but I ins't work.
Thanks for help
Sub compare()
Dim myrng As Range
Dim myrng1 As Range
Dim cel As Range
Dim cel1 As Range
Set myrng = Plan1.Range("a1:a10"
Set myrng1 = Plan1.Range("b1:b10"
For Each cel In myrng
For Each cel1 In myrng1
If cel.Value <> cel1.Value Then
cel.Selection
Selection.Copy
Columns("c".PasteSpecial
End If
Next
Next
End Sub