Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default HELP delete duplicate rows.

I have a spreadsheet with lots of duplicate rows of data.
I have run =IF(COUNTIF($A$2:A2,A2)=1,"-","Delete") to see
where duplicates appear and this is fine. I have 1,576
records of which I only need to keep 645.

What I would like to know is, how would I run a macro to
delete any rows automatically and move the the deleted
lines up so there are no blank lines between the remaining
information?

Any help is greatly appreciated.

Many thanks

Malcolm
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default HELP delete duplicate rows.

Hi Malcolm

this macro deletes rows, which have the same content in
column A. It is sorting the rows and then deleting the
doubles.
You may have to modify it for your needs.

Sub Sort_data_delete_double()

Worksheets("Sheet1").Range("A1").Sort _
key1:=Worksheets("Sheet1").Range("A1")
Set currentCell = Worksheets("Sheet1").Range("A1")
Do While Not IsEmpty(currentCell)
Set nextCell = currentCell.Offset(1, 0)
If nextCell.Value = currentCell.Value Then
currentCell.EntireRow.Delete
End If
Set currentCell = nextCell
Loop
End Sub

Wolf


-----Original Message-----
I have a spreadsheet with lots of duplicate rows of

data.
I have run =IF(COUNTIF($A$2:A2,A2)=1,"-","Delete") to see
where duplicates appear and this is fine. I have 1,576
records of which I only need to keep 645.

What I would like to know is, how would I run a macro to
delete any rows automatically and move the the deleted
lines up so there are no blank lines between the

remaining
information?

Any help is greatly appreciated.

Many thanks

Malcolm
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default HELP delete duplicate rows.

One more (non programic) help

If you would like to delete duplicated rows you can do following.
1)Select all data in your sheet where you want to delete duplicate rows
2) Data - Filter - Extended filter and check the Checkbox Without duplicite
records (maybe its called little bit differently, I have Czech version of
Excel, so I'm just translating it to EN ;-))

Then Copy and Paste the data to different Sheet

Good luck

:-))

Filip






"wolf" píse v diskusním príspevku
...
Hi Malcolm

this macro deletes rows, which have the same content in
column A. It is sorting the rows and then deleting the
doubles.
You may have to modify it for your needs.

Sub Sort_data_delete_double()

Worksheets("Sheet1").Range("A1").Sort _
key1:=Worksheets("Sheet1").Range("A1")
Set currentCell = Worksheets("Sheet1").Range("A1")
Do While Not IsEmpty(currentCell)
Set nextCell = currentCell.Offset(1, 0)
If nextCell.Value = currentCell.Value Then
currentCell.EntireRow.Delete
End If
Set currentCell = nextCell
Loop
End Sub

Wolf


-----Original Message-----
I have a spreadsheet with lots of duplicate rows of

data.
I have run =IF(COUNTIF($A$2:A2,A2)=1,"-","Delete") to see
where duplicates appear and this is fine. I have 1,576
records of which I only need to keep 645.

What I would like to know is, how would I run a macro to
delete any rows automatically and move the the deleted
lines up so there are no blank lines between the

remaining
information?

Any help is greatly appreciated.

Many thanks

Malcolm
.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete duplicate rows, keep one Wasdell Excel Discussion (Misc queries) 1 October 30th 09 12:16 PM
Delete rows with duplicate values One-Leg Excel Discussion (Misc queries) 1 February 17th 08 06:49 PM
delete duplicate rows christinaLO Excel Worksheet Functions 1 February 27th 07 06:22 PM
Delete duplicate rows christina Excel Programming 1 August 4th 03 01:04 PM
delete duplicate rows rhys Excel Programming 2 July 29th 03 12:52 PM


All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"