Hi,
I have below code where i'd like to clear all rows below 7,345 and paste the newly copied range starting row #7346. Code copy paste and appends 2 workbooks into third one and works fine however the issue is it pastes first row twice starting row 7346. So basically row 7346 and 7347 has duplicate values and the rest is correct. Appreciate anyones help!
I have below code where i'd like to clear all rows below 7,345 and paste the newly copied range starting row #7346. Code copy paste and appends 2 workbooks into third one and works fine however the issue is it pastes first row twice starting row 7346. So basically row 7346 and 7347 has duplicate values and the rest is correct. Appreciate anyones help!
VBA Code:
Private Sub CopyPasteMTDYTD()
On Error Resume Next
Application.ScreenUpdating = False
Dim Lrs As Long
Lrs = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Range("A7345:F" & Lrs).Offset(1).Clear
Workbooks.Open ("C:\Users\dokat\OneDrive - BIC\BIC\Power BI\Trade Report\Montly Data\2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm")
Dim Lr As Long
Dim ws As Worksheet
Set ws = Workbooks("2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm").Worksheets("Summary")
Lr = ws.Cells(Rows.Count, 1).End(xlUp).Row
ws.Range("A1:F" & Lr).Copy
Workbooks("Sta P&L Test.xlsm").Sheets("Sta P&L").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Workbooks("2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm").Close
Workbooks.Open ("C:\Users\dokat\OneDrive - BIC\BIC\Power BI\Trade Report\Montly Data\2017-2022 6 Year Trended PnL by L3 - February.xlsm")
Dim Lrm As Long
Dim wsm As Worksheet
Set wsm = Workbooks("2017-2022 6 Year Trended PnL by L3 - February.xlsm").Worksheets("Summary")
Lrm = wsm.Cells(Rows.Count, 1).End(xlUp).Row
wsm.Range("A2:F" & Lrm).Copy
Workbooks("Sta P&L Test.xlsm").Sheets("Sta P&L").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Workbooks("2017-2022 6 Year Trended PnL by L3 - February.xlsm").Close
Application.ScreenUpdating = True
End Sub