![]() |
Excel Macro
How do I delete duplicates from a column without deleting the row of data
-- Faz |
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 |
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 |
All times are GMT +1. The time now is 09:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com