Removing duplicates

AMunir

New Member
Joined
May 15, 2018
Messages
1
Hi Guys,

Very first time using VBA - complete Newbie. I'm using the below code to basically organise and copy data into a monthly master data sheet. I would want to build in the control to prevent duplicate values to be posted in the master data with an error message. Appreciate your help

Code:
Sub Append_data()


    Range("A1").Select
    Selection.EntireRow.Delete
    Selection.CurrentRegion.Select
    Selection.Copy
    Workbooks.Open Filename:= _
        "C:\Users\amunir\Documents\Alghanim VBA\VBA\Orders.xlsx"
    Range("A1").Select
    Selection.End(xlDown).Select
'   Range("A3259").Select
    ActiveCell.Offset(1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False
       
    ActiveWindow.Close savechanges:=True
    Range("A1").Select
    Application.CutCopyMode = False


End Sub
 
Last edited by a moderator:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
It appears that this seems to be a school/homework assignment that a lot of people are asking about.
There are 4 of you who all joined yesterday, all located in the same city, all asking similar questions:
https://www.mrexcel.com/forum/excel-...vba-excel.html
https://www.mrexcel.com/forum/excel-questions/1055776-vba-preventing-duplicates.html
https://www.mrexcel.com/forum/excel-questions/1055746-prevent-duplicate-data-using-vba.html

Note that while people may be willing to give you "hints" or point you in the right direction, please do not expect people to complete your homework assignments for you.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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