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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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