Compile /Invalid use of Property Error

MountainSound

New Member
Joined
Aug 10, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Trying to figure out why I am having issues with the following formula the goal is to have the table sorted from an input from a different sheet:

Sub Generate_Report()
Dim Region As Range
Dim Filter As Worksheet
Dim tbl As ListObject

' Set the worksheet where the filter value is located
Set Filter = ThisWorkbook.Sheets("Sheet3")

' Set the range for the filter value
Set Region = Filter.Range("B2")

' Set the table object
Set tbl = ThisWorkbook.Sheets("Combined").ListObjects("Response")

' Apply the filter to the specified column in the table based on the filter value
tbl.AutoFilter Field:=198, Criteria1:=Region.Value
End Sub

It highlights the error in the ".Autofilter" in the last line. Any help will be appreciated
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Solved I found that I needed to add "Range" in-between tbl and autofilter
 
Upvote 0
Solution

Forum statistics

Threads
1,215,326
Messages
6,124,263
Members
449,149
Latest member
mwdbActuary

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