LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Comparing and Adding

Aaron:

Would code below work as an alternative. Combine both sets of data and
delete the duplicates. This code only handles the delete process.

Alan

Sub Delete_Dupes() 'Sub deletes duplicates in a single column
'This macro will delete duplicate rows in a range.
'To use, select a single-column range of cells,
'comprising the range of rows from which duplicates are to be deleted,
'e.g., C2:C99. To determine whether a row has duplicates, the values
in the
'selected column are compared. Entire rows are not compared against one
another.
'Only the selected column is used for comparison.
'When duplicate values are found in the active column,
'the first row remains, and all subsequent rows are deleted.


Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V
Dim Rng As Range

'On Error Resume Next 'GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
ActiveSheet.UsedRange
'Cells(1, 1).Select
Col = ActiveCell.Column
If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, Col).Value
If Application.WorksheetFunction.CountIf(Rng.Columns( Col), V) 1
Then
Rng.Rows(r).Delete
N = N + 1
End If
Next r
EndMacro:
End Sub
Aaron wrote:
Good Morning all,

I need some help on coding the following
I have File1 and File2. I need File1 to look and Column A on File2 and if
there is Values there that is not in File1 Column A add it to the bottom of
File1 ColumnA
Example:

File1
Item Values
1234
2345
23456

File2
Item Values
123
2345
23456
231
234

It would add 231 and 234 to File1..

Thanks,
Aaron


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
comparing pierre Excel Discussion (Misc queries) 2 May 6th 10 06:02 AM
Comparing text and then adding numbers if the text matches rotor11 Excel Worksheet Functions 2 April 8th 09 08:38 PM
Comparing One Range and Adding Another statusquo Excel Worksheet Functions 3 December 9th 05 01:54 AM
Comparing and potentially adding two fields Avi Excel Worksheet Functions 1 November 15th 04 07:11 PM
Comparing Kirk[_4_] Excel Programming 1 December 2nd 03 08:35 PM


All times are GMT +1. The time now is 11:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"