Hi there,
as the title suggests, I am attempting to copy unique values to another sheet within the same workbook.
The dataset contains multiple columns of data. I am attempting to copy-paste unique values from Sheet("2") column K to Sheet("1") cell DE11. (The sheets actually carry such names).
A few attempts failed with my latest code throwing out run-time error '1004' Method 'Range' of object '_Global' failed when I reach code with calculation lastRow
as the title suggests, I am attempting to copy unique values to another sheet within the same workbook.
The dataset contains multiple columns of data. I am attempting to copy-paste unique values from Sheet("2") column K to Sheet("1") cell DE11. (The sheets actually carry such names).
A few attempts failed with my latest code throwing out run-time error '1004' Method 'Range' of object '_Global' failed when I reach code with calculation lastRow
VBA Code:
Sub UpdateList()
' UpdateList Macro
' Dim myApp As Excel.Application
Dim wkBk As Workbook
Dim wkSht As Object
Dim lastRow As Long
Sheets("2").Select
Range("K1").Select
Range("K2:K164").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"2!U2"), Unique:=True
lastRow = Range("U2" & Rows.count).End(xlUp).Row
wkBk.2.Range("U2:U" & lastRow).Copy
Set wkSht = wkBk.Sheets("1")
wkSht.Activate
Range("DE11").Select
wkSht.Paste
End Sub