VBA Code: Deselect Value on Table Depending on Cell Contents

_Chris

New Member
Joined
Feb 22, 2018
Messages
2
Firstly Hi.

My first post so hopefully its not me being a numpty.

I have some data in a table that depending on the value contained in a certain cell i want it to deselect the value in the cell so the rest off the macro can just delete the table contents that do not meet the requirements.

Options for the filter are:
  • TA
  • TM
  • LN
  • Legacy
  • Group

The cell that will contain the criteria for the filter selection is name ranged "T1_BU"

Now im not a guru and trying to learn as a go but sadly just only really at the moment working with recording macros and editing as i go with what i am trying to achieve but i am really stuck here.

If in the cell i have "TA" the recorded macro shows the below.
Code:
ActiveSheet.ListObjects("HubbleData").Range.AutoFilter Field:=27, Criteria1 _
        :=Array("Group.", "Legacy.", "LN.", "TM.", "="), Operator:=xlFilterValues
I think somewhere i need to delete the array and have a <>Range(T1_BU) or something like that but it doesn't appear to be working.

Hopefully that will explain what i am trying to get at and any help really appreciated!

Thanks in advance.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

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