Solved

Select then remove duplicates

Posted on 2014-11-27
2
78 Views
Last Modified: 2014-11-27
can an Expert assist me with this, I am sure it is simple but obviously not for me.

I am using the below code to select the current range:

Range(Range("A98"), Cells.SpecialCells(xlCellTypeLastCell)).Select

I then want to remove all duplicates from column B within that range [without using a named range like

ActiveSheet.Range("$A$98:$AB$103").RemoveDuplicates Columns:=2, Header:= _
        xlNo

and then I want to sort on column B

Row 98 is the header row for the Range and the number of rows below 98 will vary every time we run the report.

Thanks
0
Comment
Question by:Jagwarman
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40468727
Hi,

pls try

Set myRange = Range(Range("A98"), Cells.SpecialCells(xlCellTypeLastCell))
myRange.RemoveDuplicates Columns:=2, Header:=xlYes
myRange.Sort key1:=Range("B98"), _
      order1:=xlAscending, Header:=xlYes

Open in new window

Regards
0
 

Author Comment

by:Jagwarman
ID: 40468759
I changed this myRange.RemoveDuplicates Columns:=2, Header:=xlYes

to this

myRange.RemoveDuplicates Columns:=2, Header:=xlNo

And it works

Thanks Rgonzo
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question