ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clearing duplicate values in Column A (https://www.excelbanter.com/excel-programming/404759-clearing-duplicate-values-column.html)

S Himmelrich

clearing duplicate values in Column A
 
this solution deletes the row, I only want to clear the duplicate in
Column A.
Dim rng As Range
Dim i As Integer
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
For i = rng.Rows(rng.Rows.Count).Row To rng.Row + 1 Step -1
If Cells(i, 1).Value = Cells(i - 1, 1) Then
Cells(i, 1).Delete shift:=xlUp
End If
Next

GTVT06

clearing duplicate values in Column A
 
On Jan 22, 3:58*pm, S Himmelrich wrote:
this solution deletes the row, I only want to clear the duplicate in
Column A.
Dim rng As Range
Dim i As Integer
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
For i = rng.Rows(rng.Rows.Count).Row To rng.Row + 1 Step -1
* * If Cells(i, 1).Value = Cells(i - 1, 1) Then
* * Cells(i, 1).Delete shift:=xlUp
* * End If
Next

Try this one

Dim rng As Range
Dim i As Integer
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
For i = rng.Rows(rng.Rows.Count).Row To rng.Row + 1 Step -1
If Cells(i, 1).Value = Cells(i - 1, 1) Then
Cells(i, 1).ClearContents
End If
Next


All times are GMT +1. The time now is 12:01 AM.

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