Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA Object doesn't support this property or method

Tags:

People also ask

How do I fix object doesn't support this property or method?

Use the Object Browser to determine what members (properties and methods) are available for the selected class (object). Use the IntelliSense feature in the Visual Basic Editor. When you type a period (.) after a property or method in the Visual Basic Editor, a list of available properties and methods is displayed.

What is run time error 438 in VBA?

VBA error 438 occurs when you try to use a property or method that does not support by that object. as you know all the objects have some properties and methods that you can use but there could be a situation when using a property or method that does not apply to a particular object.


I need to simply count the number of areas on a sheet. The code I have is :

Sub areas()
   Dim i As Long
   i = Worksheets("Sheet2").Selection.Areas.Count
   MsgBox i
End Sub

But for some reason I get the error message "Object doesn't support this property or method." I have no idea why. This code was basically just copied from the Microsoft website.

I can't even get the immediate window to print the Worksheets("Sheet2").Selection.Areas.Count portion.

Any quick help? I am using Excel 2010.

Thanks.