OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Thanks in advance and I will let you know if it works once I get a response.
Given: Sheet 1 and Sheet 2 exist and Sheet 1 has data where Shee2 1 only has headings
Objective: Copy cells A2 through last entry in column A of Sheet 1 and paste it into Sheet 2 starting at A2 and then delete the duplicates
The error message I get is at ".Rows" of in the following line:
LastRow12 = .Range("A" & .Rows.Count).End(xlUp).Row
Given: Sheet 1 and Sheet 2 exist and Sheet 1 has data where Shee2 1 only has headings
Objective: Copy cells A2 through last entry in column A of Sheet 1 and paste it into Sheet 2 starting at A2 and then delete the duplicates
The error message I get is at ".Rows" of in the following line:
LastRow12 = .Range("A" & .Rows.Count).End(xlUp).Row
Code:
Sub Binder()
Worksheets("Sheet1").Activate
'Settings
Dim WSBTEI As Worksheet
Set WSBTEI = ThisWorkbook.Sheets("Sheet1")
'Copy the First Column starting with cell A2 (i.e. don't copy the heading)
WSBTEI.Columns(4).Copy Destination:=Sheets("Sheet2").Columns(1)
'Remove Duplicates & Sort
Worksheets("Sheet2").Activate
Dim LastRow12 As Long
LastRow12 = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("A2:A" & LastRow12).RemoveDuplicates Columns:=Array(1, 1), Header:=xlYes
End With
End Sub
Last edited: