Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Select then remove duplicates

Posted on 2014-11-27
2
Medium Priority
?
82 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

715 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