Run Time Error 438 Object Doesn't Support this Property or Method

LtCmdrData

Board Regular
Joined
Jan 24, 2018
Messages
58
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm getting the error above when I try to run a macro to clear a report and reset things for the next time. Specifically it is supposed to unhide a sheet, turns off the advanced filter so the contents can be cleared, and hide the sheet again. I am running Excel 2016 on Windows 10. The If Then Statement below in red is what is coming up as the error. Can anyone tell me why I am getting this error and how to fix it? Thanks! Here is the code:

Sub ClearContents()
'
' ClearContents Macro
'


Dim lrow As Long, ws As Worksheet
Set ws = ThisWorkbook.Sheets("Filter")
lrow = ws.Range("A" & Rows.Count).End(xlUp).Row
'
Cells.Select
Selection.ClearContents
Range("A1").Select

Sheets("Filter").Visible = True

Sheets("Filter").Select
If ActiveSheet.FliterMode Then ActiveSheet.ShowAllData
Range("A6:J" & lrow).Select
Selection.ClearContents
Range("A6").Select

Sheets("Filter").Visible = False
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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