Run Time Error 438 Object Doesnt Support This Property or Method Error

Dokat

Active Member
Joined
Jan 19, 2015
Messages
304
Office Version
  1. 365
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



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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
It would help in future if you could say where the error occurred. ;)
However this Dim wb As Worksheets should be Worksheet singular
 
Upvote 0
It would help in future if you could say where the error occurred. ;)
However this Dim wb As Worksheets should be Worksheet singular
Thanks for your reply I changed it to Worksheet. Now after it runs following code
VBA Code:
Range("A7346:F" & LRW).ClearContents
it returns Run Time Error 1004. Thanks

1647897675866.png
 
Upvote 0
I can see no reason why you would get that error on that line. What is the value of LRW when you get the error?
 
Upvote 0
Do you have only the one sheet in the workbook that contains the code?
 
Upvote 0
Do you have only the one sheet in the workbook that contains the code?
I ran the code line by line and it returns error after running below line.
VBA Code:
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")
 
Upvote 0
Is that the line that caused the error, if so what was the error?
 
Upvote 0
Is that the line that caused the error, if so what was the error?
I am not sure if that line is what causing the error. That line opens up another workbook which it executes. But after opening the other workbook i receive below error message.

1647899453250.png
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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