Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy cell to another column

Status
Not open for further replies.

amecari

Technical User
Mar 21, 2001
29
BR
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(n) into B(n) 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(&quot;d&quot;).PasteSpecial

End If

Next
Next
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top