VBA to clear duplicate dates in column but keep row

Tocix

New Member
Joined
Apr 17, 2016
Messages
45
Office Version
  1. 365
Good morning,

Please help me out with macros that would cleared out duplicate dates on column A but keep all rows. For example clear out the one I have it in red.

ABCD
110/15/2019lesson plansTBATBA
210/15/2019
homework
TBATBA
310/15/2019extra credit
TBATBA
4
510/16/2019TBATBATBA
610/16/2019TBATBATBA
10/17/2019TBATBATBA

<tbody>
</tbody>


Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try applying conditional formatting to the used part of column A. Use =A1=A2 as the rule, then set the font colour the same as the fill colour.

This will hide the date instead of removing them, which is more useful if you need to summarise your data by date at a later point.
 
Upvote 0
When I copied to another sheet the duplicate dates still carried over. I just want to clear it out completely that way my other sheet only have one date shown.
 
Upvote 0
The conditional formatting will carry over as well so the duplicates will be hidden in the copy.
 
Upvote 0
Try
Rich (BB code):
Sub Remove_Dupes()
  Dim r As Long
  
  For r = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    If Range("A" & r).Value = Range("A" & r - 1).Value Then Range("A" & r).ClearContents
  Next r
End Sub
 
Upvote 0
Try
Rich (BB code):
Sub Remove_Dupes()
  Dim r As Long
  
  For r = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    If Range("A" & r).Value = Range("A" & r - 1).Value Then Range("A" & r).ClearContents
  Next r
End Sub

Works perfectly! thank you very much for your help.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top