aalhinai123
New Member
- Joined
- Apr 9, 2019
- Messages
- 1
Hi All,
Im very new in VBA and trying to build my own coding by recording macros.
However, I stacked in trying to find a way in preventing DUPLICATE DATA to be copied from one sheet file and paste in another sheet file.
I have used remove duplicate in my coding (as per mentioned below) but im trying to find a way where Macro will prevent proceeding with duplicate data.
Thanks,
Sub Append_data()
'
' Append_data Macro
'
'
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Selection.CurrentRegion.Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Users\Administrator\Documents\Oman VBA\VBA\Orders.xlsx"
Range("A1").Select
Selection.End(xlDown).Select
' Range("A3267").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Selection.CurrentRegion.RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7) _
, Header:=xlYes
ActiveWindow.Close savechanges:=True
Application.CutCopyMode = False
Im very new in VBA and trying to build my own coding by recording macros.
However, I stacked in trying to find a way in preventing DUPLICATE DATA to be copied from one sheet file and paste in another sheet file.
I have used remove duplicate in my coding (as per mentioned below) but im trying to find a way where Macro will prevent proceeding with duplicate data.
Thanks,
Sub Append_data()
'
' Append_data Macro
'
'
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Selection.CurrentRegion.Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Users\Administrator\Documents\Oman VBA\VBA\Orders.xlsx"
Range("A1").Select
Selection.End(xlDown).Select
' Range("A3267").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Selection.CurrentRegion.RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7) _
, Header:=xlYes
ActiveWindow.Close savechanges:=True
Application.CutCopyMode = False