Solved

Select then remove duplicates

Posted on 2014-11-27
2
77 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 49

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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