VBA Data validation

foxozaur

New Member
Joined
Sep 24, 2019
Messages
11
Greetings MrExcel community,

I'm working on a VBA macro that allows me to send values from source workbook to destination workbook, with duplicates validation message box that provides two options - delete or retain. I'm done with the copy pasting values from source to destination files, however, I am struggling with the validating duplicates, the message box with two options "Keep or Delete" and removing duplicates within the destination file (the origin file does not matter in this case). A gentle reminder that this is a part of an existing macro!

Thanks in advance!

This is the sample file. I will lay every step I'd like to see in the macro.

This is the destination file with duplicates titled 'destinationfile.csv.'
1.PNG

I want the file to do the following:

1) validate total duplicates (I have built a SQL data feed) by locating the duplicate name
*No idea how to visualize it through excel, will use paint for that.
22222.png


2) pop a message box with a request to keep or delete (THIS IS ONLY FOR COLUMN B)
*No idea how to visualize it through excel, will use paint again.
Inked22_LI.jpg



3) The macro then deletes the selected ones, and displays the total deleted duplicates
2.PNG
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
When it throws the error can you paste the following line into the Immediate Window (press Ctrl+G in the Visual Basic Editor to get the Immediate Window if you don't already have it)

debug.print rDupe.Row & " - " & rLast.Row

then press enter, and it should print two numbers separated by a hyphen on the next line in the immediate window, like this;

1581083491642.png


I suspect that the two numbers will be the same - in which case we'll need to have a look at your real-world dataset, as it sounds like it doesn't fit some of the original assumptions
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
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