Solved

Select then remove duplicates

Posted on 2014-11-27
2
79 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 51

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

739 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