Extracting unique numbers

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,581
Office Version
  1. 2021
Platform
  1. Windows
I have a workbook called Audit Trail (source workbook). I have data in culumn F consisting of account numbers. The same number can appear several times. I would like a macro to extract only unique numbers on the destination workbook called Data extraction i.e the same number only to be extracted once

Example of data in Col F

8110
7565
7010
7435
7565
6000
6001
8110
7565


The data to be extracted is as follows i.e unique numbers

8110
7565
7010
7435
6000
6001


Your assistance is most appreciated
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi,
try using the following macro:
Code:
Sub UniqVal()
Dim f&

f = Cells(Rows.Count, "F").End(xlUp).Row
Range("F1:F" & f).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("G1"), Unique:=True
End Sub
Best regards.
 
Upvote 0
Try:
Code:
Public Sub GetUniques()
Dim objDic As Object
Set objDic = CreateObject("Scripting.Dictionary")
For i = 2 To Range("F" & Rows.Count).End(xlUp).Row
    If Not objDic.exists(Range("F" & i).Value) Then _
    objDic.Add Range("F" & i).Value, Range("F" & i).Value
Next i
Range("G2").Resize(objDic.Count, 1).Value = Application.Transpose(objDic.keys)
End Sub
 
Upvote 0
Hi Hurgadaion

Thanks for the help. When Activating the macro, nothing happens. please check code & advise

regards

Howard
 
Upvote 0
I don't know what is Your Problem... In My WorkSheet the above macro is working. Maybe try taurean's macro or try to solve Your problem alone. The problem of Unique Values is rather conventional, best regards.
 
Last edited:
Upvote 0
Hi Shrivallabha

Thanks for the help most appreciated

Regards

Howard
 
Upvote 0

Forum statistics

Threads
1,219,161
Messages
6,146,657
Members
450,706
Latest member
LGVBPP

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top