How to remove a duplicat appointment time

ukphoenix

New Member
Joined
Jul 25, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hi Guys and Girls

You have been a great help so far but am looking to tweek now.

Currently all the macros incorporated in the workbook are working fine and doing what they need to do. What I need added is a macro that deletes rows based on a time leaving only 1 at that time.
Attached is a sample and as you can see in column A there are 2 loads at some hours. The macro needs to recognise this based on appointment time (column A) and lowest number in Column F.

If results are the same ie rows 15 & 16 then it needs to delete either row leaving 1 for 09:00

Any help is appreciated

Due to company privacy i am unable to install XL2BB so can only supply screen shots, sorry
 

Attachments

  • sample1.JPG
    sample1.JPG
    160.3 KB · Views: 3

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You actually do not need VBA to do this. Excel has built-in "Remove Duplicates" functionality (found under "Data Tools" on the "Data" menu).
Just sort your data so that the record you want to keep always come first, then you can remove duplicates rows telling Excel exactly which columns you want to use for the duplicate determination.

If you really want this as part of your VBA code, you can turn on the Macro Recorder and record yourself performing these steps manually.
That should give you most of the code that you need. If you need any help cleaning up that code after recording, post it here and let us know what you need.
 
Upvote 0
You actually do not need VBA to do this. Excel has built-in "Remove Duplicates" functionality (found under "Data Tools" on the "Data" menu).
Just sort your data so that the record you want to keep always come first, then you can remove duplicates rows telling Excel exactly which columns you want to use for the duplicate determination.

If you really want this as part of your VBA code, you can turn on the Macro Recorder and record yourself performing these steps manually.
That should give you most of the code that you need. If you need any help cleaning up that code after recording, post it here and let us know what you need.
Thanks for the info, didnt even realise that function was there. Have created a macro off it and works a treat
 
Upvote 0
You are welcome.
Yeah, it is fairly new functionality (not on the real old version of Excel), and a pretty cool tool!
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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