#1   Report Post  
Posted to microsoft.public.excel.programming
Faz Faz is offline
external usenet poster
 
Posts: 8
Default Excel Macro

How do I delete duplicates from a column without deleting the row of data
--
Faz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Excel Macro

If it is a true duplicate, why would you want to keep the row of data?
Would it not be the same as the duplicate row? If you only want to delete
the found range then something like this:

Set MyRange = Sheets(1).Range("A2:A100")
For i = 100 to 2 Step - 1 'force of habit
If Sheets(1).Cells(i, 1) = Sheets(1).Cells(i - 1, 1) Then
Sjeets(1).Cells(i, 1).ClearContents
End If
Next

This assumes that the file is sorted on column A so that duplicates are
grouped.
The problem with this is that now there will be a row of data with nothing
in column A that it ties to. This may or may not be significant, depending
on the user's data base format and needs.



"Faz" wrote in message
...
How do I delete duplicates from a column without deleting the row of data
--
Faz



  #3   Report Post  
Posted to microsoft.public.excel.programming
Faz Faz is offline
external usenet poster
 
Posts: 8
Default Excel Macro

This works great..Thanks!!!
--
Faz


"JLGWhiz" wrote:

If it is a true duplicate, why would you want to keep the row of data?
Would it not be the same as the duplicate row? If you only want to delete
the found range then something like this:

Set MyRange = Sheets(1).Range("A2:A100")
For i = 100 to 2 Step - 1 'force of habit
If Sheets(1).Cells(i, 1) = Sheets(1).Cells(i - 1, 1) Then
Sjeets(1).Cells(i, 1).ClearContents
End If
Next

This assumes that the file is sorted on column A so that duplicates are
grouped.
The problem with this is that now there will be a row of data with nothing
in column A that it ties to. This may or may not be significant, depending
on the user's data base format and needs.



"Faz" wrote in message
...
How do I delete duplicates from a column without deleting the row of data
--
Faz




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
Avoid Outlook macro security for Excel bades macro blackbox via OfficeKB.com Excel Programming 4 June 15th 07 08:51 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM


All times are GMT +1. The time now is 04:42 PM.

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"