thedeadzeds
Active Member
- Joined
- Aug 16, 2011
- Messages
- 442
- Office Version
- 365
- Platform
- Windows
Hi Guys,
I'm trying to copy and past data from the 'Sort Tab' to the 'ScoreCard' tab last row. For some reason when using the below it pastes the data to row 56? Can someone please help?
Thanks
I'm trying to copy and past data from the 'Sort Tab' to the 'ScoreCard' tab last row. For some reason when using the below it pastes the data to row 56? Can someone please help?
Thanks
VBA Code:
Sub Core()
If MsgBox("Are you sure you want to run VBA?", vbYesNo) = vbNo Then Exit Sub
Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Sort") '<== Sheet that has raw data
Dim LRow As Long, Found As Range
Dim Lastrow As String
Dim Lastrow2 As String
Lastrow = Sheets("Overall Summary").Cells(Rows.Count, "A").End(xlUp).Row
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Site2
Sheets("Sort").Select
ActiveSheet.ListObjects("ScoreCard").Range.AutoFilter Field:=5, Criteria1:= _
"<>"
Set Found = ws.Range("L1:W1").Find("Site2") '<== Header name to search for"
If Not Found Is Nothing Then
LRow = ws.Cells(ws.Rows.Count, Found.Column).End(xlUp).Row
ws.Range(ws.Cells(2, Found.Column), ws.Cells(LRow, Found.Column)).Copy
Sheets("ScoreCard").Range("A" & Lastrow + 1).PasteSpecial xlPasteValues '<== Sheet to paste data
End If
ws.Activate
ActiveSheet.Select
End Sub