Lovelylou79
New Member
- Joined
- Sep 4, 2017
- Messages
- 37
Hi There Forum,
I have pilfered a great code that finds duplicates on two sheets and highlights the duplicates on the newest sheet.
I'd like to add a function that will copy the data from rng1 "K" and paste into rng2 "K" as well as highlighting.
I've tried manipulating the code myself, but I can't seem to get it right.
This is the code I'm using;
Dim lastrow As Integer
lastrow = FindLastRow
Range("L2:L" & lastrow).Formula = "=A2 & F2 & G2 & H2"
Sheets("ps").Activate
Range("L2:L" & lastrow).Formula = "=A2 & F2 & G2 & H2"
'Checks for dupliactes
Dim cell As Range, cella As Range, rng As Range, srng As Range
Set rng1 = Sheets(ComboBox1.Value).Range("L2:L" & lastrow)
Set rng2 = Sheets("ps").Range("L2:L" & lastrow)
For Each cell In rng1
For Each cella In rng2
If cella = cell Then
cella.EntireRow.Interior.ColorIndex = 15
End If
Next cella
Next cell
'Clears Concatenated data after function
Sheets(ComboBox1.Value).Range("L2:L" & lastrow).ClearContents
Sheets("ps").Range("L2:L" & lastrow).ClearContents
Thanks in advance!
I have pilfered a great code that finds duplicates on two sheets and highlights the duplicates on the newest sheet.
I'd like to add a function that will copy the data from rng1 "K" and paste into rng2 "K" as well as highlighting.
I've tried manipulating the code myself, but I can't seem to get it right.
This is the code I'm using;
Dim lastrow As Integer
lastrow = FindLastRow
Range("L2:L" & lastrow).Formula = "=A2 & F2 & G2 & H2"
Sheets("ps").Activate
Range("L2:L" & lastrow).Formula = "=A2 & F2 & G2 & H2"
'Checks for dupliactes
Dim cell As Range, cella As Range, rng As Range, srng As Range
Set rng1 = Sheets(ComboBox1.Value).Range("L2:L" & lastrow)
Set rng2 = Sheets("ps").Range("L2:L" & lastrow)
For Each cell In rng1
For Each cella In rng2
If cella = cell Then
cella.EntireRow.Interior.ColorIndex = 15
End If
Next cella
Next cell
'Clears Concatenated data after function
Sheets(ComboBox1.Value).Range("L2:L" & lastrow).ClearContents
Sheets("ps").Range("L2:L" & lastrow).ClearContents
Thanks in advance!