Not finding last row - copy and pasted to last row

thedeadzeds

Active Member
Joined
Aug 16, 2011
Messages
442
Office Version
  1. 365
Platform
  1. 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


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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You are calculating the last row based on data in the "Overall Summary" sheet, rather than the "ScoreCard" sheet.
 
Upvote 0
Solution
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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