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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,353
Messages
6,124,458
Members
449,161
Latest member
NHOJ

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