Hi,
I have a report i would like append data from another workbook. The name of the workbook is "Sta P&L Test, and worksheet is Sta P&L . Data range that i'd like to copy from comes from following workbook ."2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm" Range starts from A2:F to last row. I have below code however when I ran I receive Error 438 message. Did anyone come across same issue and have a solution for it? Thanks
I have a report i would like append data from another workbook. The name of the workbook is "Sta P&L Test, and worksheet is Sta P&L . Data range that i'd like to copy from comes from following workbook ."2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm" Range starts from A2:F to last row. I have below code however when I ran I receive Error 438 message. Did anyone come across same issue and have a solution for it? Thanks
VBA Code:
Private Sub WorkbookOpen()
Application.ScreenUpdating = False
Dim LRW As Long
LRW = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Range("A7346:F" & LRW).ClearContents
Workbooks.Open ("C:\Users\dokat\OneDrive - Sta\Sta\Power BI\Trade Report\Montly Data\2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm")
Dim LR As Long
Dim wb As Worksheets
Set wb = Workbooks("2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm").Worksheeets("Summary")
LR = wb.Cells(Rows.Count, 1).End(xlUp).Row
Range("A2:F" & Range("A" & Rows.Count).End(xlUp).Row).Copy
Workbooks("Sta P&L Test.xlsm").Activate
Range("A" & LR + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Workbooks("2017-2022 6 Year Trended PnL by L3 - YTD February.xlsm").Close
Application.ScreenUpdating = True
End Sub