Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting unique entries from an array/column


Hi,

I would like to make an array of unique entries from another array or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=564651

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Getting unique entries from an array/column


Sub CopyData()
Columns("B:B").Insert
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("B1"), _
Unique:=True
Columns("B:B").Copy Sheets("Sheet2").Range("A1")
Columns("B:B").Delete Shift:=xlToLeft
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"erikhs" wrote in
message ...

Hi,

I would like to make an array of unique entries from another array or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile:

http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=564651



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Getting unique entries from an array/column

If you have a header in that column:
Columns(1).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=worksheets("Sheet2").Range("A1"), _
Unique:=True

If not, temporarily put a header there, then remove it after your done.
(using code).

--
Regards,
Tom Ogilvy



"erikhs" wrote:


Hi,

I would like to make an array of unique entries from another array or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=564651


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Getting unique entries from an array/column

Just to add to Bob's excellent advice:
Bob appears to be under the mistaken impression that advancedfilter can't
copy to another sheet. That is incorrect. It can. Use of the dummy column
B is not required.

Sub CopyData()
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("Sheet2") _
.Range("A1"), _
Unique:=True
End Sub


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:


Sub CopyData()
Columns("B:B").Insert
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("B1"), _
Unique:=True
Columns("B:B").Copy Sheets("Sheet2").Range("A1")
Columns("B:B").Delete Shift:=xlToLeft
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"erikhs" wrote in
message ...

Hi,

I would like to make an array of unique entries from another array or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile:

http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=564651




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Getting unique entries from an array/column

I certainly was. Looking at it, that seems to be correct for filtering in
Excel, I mistakenly assumed that would also apply to filtering via VBA. I'll
file that away.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tom Ogilvy" wrote in message
...
Just to add to Bob's excellent advice:
Bob appears to be under the mistaken impression that advancedfilter can't
copy to another sheet. That is incorrect. It can. Use of the dummy

column
B is not required.

Sub CopyData()
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("Sheet2") _
.Range("A1"), _
Unique:=True
End Sub


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:


Sub CopyData()
Columns("B:B").Insert
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("B1"), _
Unique:=True
Columns("B:B").Copy Sheets("Sheet2").Range("A1")
Columns("B:B").Delete Shift:=xlToLeft
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"erikhs" wrote in
message ...

Hi,

I would like to make an array of unique entries from another array or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs


------------------------------------------------------------------------
erikhs's Profile:

http://www.excelforum.com/member.php...o&userid=32788
View this thread:

http://www.excelforum.com/showthread...hreadid=564651








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Getting unique entries from an array/column

You can do the same in Excel. You just have to start at the destination cell
when you start the advanced filter and it may balk, by saying it can't
determime the data, but continuing on and it works. It is cleaner in later
versions, but I know for sure it works in xl97 and later and probably earlier
too.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

I certainly was. Looking at it, that seems to be correct for filtering in
Excel, I mistakenly assumed that would also apply to filtering via VBA. I'll
file that away.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tom Ogilvy" wrote in message
...
Just to add to Bob's excellent advice:
Bob appears to be under the mistaken impression that advancedfilter can't
copy to another sheet. That is incorrect. It can. Use of the dummy

column
B is not required.

Sub CopyData()
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("Sheet2") _
.Range("A1"), _
Unique:=True
End Sub


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:


Sub CopyData()
Columns("B:B").Insert
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("B1"), _
Unique:=True
Columns("B:B").Copy Sheets("Sheet2").Range("A1")
Columns("B:B").Delete Shift:=xlToLeft
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"erikhs" wrote in
message ...

Hi,

I would like to make an array of unique entries from another array or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs

------------------------------------------------------------------------
erikhs's Profile:
http://www.excelforum.com/member.php...o&userid=32788
View this thread:

http://www.excelforum.com/showthread...hreadid=564651







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Getting unique entries from an array/column

It works fine in XP. Thanks for that, I didn't know.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tom Ogilvy" wrote in message
...
You can do the same in Excel. You just have to start at the destination

cell
when you start the advanced filter and it may balk, by saying it can't
determime the data, but continuing on and it works. It is cleaner in

later
versions, but I know for sure it works in xl97 and later and probably

earlier
too.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

I certainly was. Looking at it, that seems to be correct for filtering

in
Excel, I mistakenly assumed that would also apply to filtering via VBA.

I'll
file that away.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tom Ogilvy" wrote in message
...
Just to add to Bob's excellent advice:
Bob appears to be under the mistaken impression that advancedfilter

can't
copy to another sheet. That is incorrect. It can. Use of the dummy

column
B is not required.

Sub CopyData()
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("Sheet2") _
.Range("A1"), _
Unique:=True
End Sub


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:


Sub CopyData()
Columns("B:B").Insert
Range("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("B1"), _
Unique:=True
Columns("B:B").Copy Sheets("Sheet2").Range("A1")
Columns("B:B").Delete Shift:=xlToLeft
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"erikhs" wrote

in
message ...

Hi,

I would like to make an array of unique entries from another array

or
column(preferably a dynamic range), and then paste back to the
worksheet on a different sheet. How do i do this with the least
possible code?


--
erikhs


------------------------------------------------------------------------
erikhs's Profile:
http://www.excelforum.com/member.php...o&userid=32788
View this thread:

http://www.excelforum.com/showthread...hreadid=564651









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
Array formula for unique entries Martina Excel Worksheet Functions 4 August 11th 07 02:00 AM
Extract Unique entries in a column Jeff Excel Worksheet Functions 4 October 18th 05 08:04 PM
set up a column in excel with unique entries Richard Excel Discussion (Misc queries) 2 March 6th 05 08:15 PM
How to validate data entries to be unique within an array Dwight at Boeing Excel Worksheet Functions 1 February 15th 05 06:30 PM
Restrict a column to allow only unique entries? Gabe Excel Programming 6 February 12th 04 04:16 PM


All times are GMT +1. The time now is 11:38 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"