Update Records without Duplicate

airforceone

Board Regular
Joined
Feb 14, 2022
Messages
215
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Good Day Mate,

Got my main workbook and running workbook, updating the main workbook with the following code and works fine then calling removeduplicate module to remove any duplicate record if any!

VBA Code:
Workbooks.Open ThisWorkbook.Path & "\CONSO.xlsx"
Set wsTarget = ActiveWorkbook.Worksheets("TARGET")
Set wsSource = ThisWorkbook.Worksheets("SOURCE")
ColSource = wsSource.Cells(1, Columns.count).End(xlToLeft).Column
LColChar = Split(Cells(1, ColSource).Address, "$")(1)
lrSource = wsSource.Cells(wsSource.Rows.count, "A").End(xlUp).Row
lrTarget = wsTarget.Cells(wsTarget.Rows.count, "A").End(xlUp).Offset(1).Row
wsSource.Range("A2:" & LColChar & lrSource).Copy wsTarget.Range("A" & lrTarget)
wsTarget.Parent.Close True

Set wsSource = Sheets("CURRENT")
lrSource = wsSource.Range("A" & Rows.count).End(xlUp).Row
For ctrLoop = 2 To lrSource
    wsSource.Range("A1:AN" & lrSource).RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes
Next

my query is, if I may? is there a way to test my Control Number before appending the running workbook to my main workbook to eliminate calling my RemoveDuplicate Module?
 

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