Hi there,
I've created a macro which will send all rows from a worksheet to another worksheet in a different workbook. Currently it will send everything from column A - Column U until there's an empty row.
I was wondering if there is a way to skip duplicate rows. So for example if the cells in row A2:U2 matched a row in the second workbook, it would skip sending that row!
Below is the code I'm using, and I've attached an example spreadsheet to give a clearer view of what I'm trying to achieve.
Thanks for any help in advance
Sub uploadmacro() Dim SourceRange As Range Dim DestRange As Range Dim DestWB As Workbook Dim DestSh As Worksheet Dim Lr As Long With Application .ScreenUpdating = False .EnableEvents = False End With If bIsBookOpen_RB("mastersheet.xls") Then Set DestWB = Workbooks("mastersheet.xls") Else Set DestWB = Workbooks.Open("T:\Folder\Folder2\mastersheet.xlsm") End If Set DestSh = DestWB.Worksheets("masterachieved") Lrs = LastRow(ThisWorkbook.Sheets("examplesheet")) For T_ros = 2 To Lrs Set SourceRange = ThisWorkbook.Sheets("examplesheet").Range("A" & T_ros & ":" & "U" & T_ros) Lr = LastRow(DestSh) Set DestRange = DestSh.Range("A" & Lr + 1) With SourceRange Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count) End With DestRange.Value = SourceRange.Value Next T_ros DestWB.Close savechanges:=True With Application .ScreenUpdating = True .EnableEvents = True End With End Sub
Bookmarks