MountainSound
New Member
- Joined
- Aug 10, 2023
- Messages
- 2
- Office Version
- 365
- Platform
- 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
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