Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Extract duplicates from two list to another sheet

I have a list of numbers in column B. I have another list in column I
on sheet1.

Any codes to extract any duplicates (numbers found) to column C in
sheet2 using code?
Formulas takes too long and locks up workbook.


Thanx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Extract duplicates from two list to another sheet

On Feb 20, 12:16*pm, "J.W. Aldridge"
wrote:
I have a list of numbers in column B. I have another list in column I
on sheet1.

Any codes to extract any duplicates (numbers found) to column C in
sheet2 using code?
Formulas takes too long and locks up workbook.

Thanx


I haven't really done much of this (and there is likely a more
efficient method), but off the top of my head I know that you can load
both sets of ranges into arrays and loop through the arrays.

Sub Macro1()
Dim rngRange1 As Range
Dim rngRange2 As Range

Dim rngRange1Cell As Range
Dim rngRange2Cell As Range

Dim varRange1Val As Variant
Dim varRange2Val As Variant

Set rngRange1 = Worksheets(1).Range("a2:a4")
Set rngRange2 = Worksheets(1).Range("b2:b4")

For Each rngRange1Cell In rngRange1.Cells
varRange1Val = rngRange1Cell.Value
For Each rngRange2Cell In rngRange2.Cells
varRange2Val = rngRange2Cell.Value
If varRange1Val = varRange2Val Then
'Extract
End If
Next
Next

End Sub

Matt
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Extract duplicates from two list to another sheet

On Feb 20, 12:30*pm, wrote:
On Feb 20, 12:16*pm, "J.W. Aldridge"
wrote:

I have a list of numbers in column B. I have another list in column I
on sheet1.


Any codes to extract any duplicates (numbers found) to column C in
sheet2 using code?
Formulas takes too long and locks up workbook.


Thanx


I haven't really done much of this (and there is likely a more
efficient method), but off the top of my head I know that you can load
both sets of ranges into arrays and loop through the arrays.

Sub Macro1()
Dim rngRange1 As Range
Dim rngRange2 As Range

Dim rngRange1Cell As Range
Dim rngRange2Cell As Range

Dim varRange1Val As Variant
Dim varRange2Val As Variant

Set rngRange1 = Worksheets(1).Range("a2:a4")
Set rngRange2 = Worksheets(1).Range("b2:b4")

For Each rngRange1Cell In rngRange1.Cells
* * varRange1Val = rngRange1Cell.Value
* * For Each rngRange2Cell In rngRange2.Cells
* * * * varRange2Val = rngRange2Cell.Value
* * * * If varRange1Val = varRange2Val Then
* * * * * * 'Extract
* * * * End If
* * Next
Next

End Sub

Matt


I know I said "arrays" but I meant range object(s). However, you
could also create arrays to do this same process.

Matt
Reply
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
how could i extract data from another sheet like list box Muneeb Excel Worksheet Functions 1 August 3rd 09 05:30 PM
Condensing a list with duplicates to a list with non-duplicates Nuclear Excel Worksheet Functions 2 July 29th 08 08:03 PM
Array Formulas - Unique List from List with Duplicates Johnny Meredith Excel Discussion (Misc queries) 7 October 27th 06 09:26 PM
Search a worksheet, extract rows using a list from another sheet bobf Excel Discussion (Misc queries) 9 August 31st 05 04:56 AM
extract list of names and elimanate duplicates Frank Kabel Excel Worksheet Functions 2 October 27th 04 04:52 PM


All times are GMT +1. The time now is 07:35 PM.

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"