ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort Data for duplicates (https://www.excelbanter.com/excel-programming/327527-sort-data-duplicates.html)

Mike B

Sort Data for duplicates
 
I would like some code that will sort my data based on column B. I do not
want to delete the duplicates, just have them togetherfor this macro.

I would like a seperate macro just to delte the dups based on column B

Thanks.
I want to see the steps for future improvement in the code
--
Mike B

Jim Thomlinson[_3_]

Sort Data for duplicates
 
Already added to your last post...

Public Sub SortStuff()
Dim wks As Worksheet
Dim rng As Range

Set wks = ActiveSheet
Set rng = wks.Cells

rng.Sort Key1:=wks.Range("B2"), Order1:=xlAscending, Header:=xlYes

Set wks = Nothing
Set rng = Nothing
End Sub

"mike b" wrote:

I would like some code that will sort my data based on column B. I do not
want to delete the duplicates, just have them togetherfor this macro.

I would like a seperate macro just to delte the dups based on column B

Thanks.
I want to see the steps for future improvement in the code
--
Mike B


Mike B

Sort Data for duplicates
 
Thanks

"Jim Thomlinson" wrote:

Already added to your last post...

Public Sub SortStuff()
Dim wks As Worksheet
Dim rng As Range

Set wks = ActiveSheet
Set rng = wks.Cells

rng.Sort Key1:=wks.Range("B2"), Order1:=xlAscending, Header:=xlYes

Set wks = Nothing
Set rng = Nothing
End Sub

"mike b" wrote:

I would like some code that will sort my data based on column B. I do not
want to delete the duplicates, just have them togetherfor this macro.

I would like a seperate macro just to delte the dups based on column B

Thanks.
I want to see the steps for future improvement in the code
--
Mike B



All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com