Originally Posted by
SARAN89
Do you mean that the criteria will be based on the user's selection on Sheet2 ?
(so it doesn't matter on what column/row where the criteria text are)
Yes by User Selection within work book its not fixed Sheet2
So,
A. it's possible the text contains the criteria are in another Sheet ya ? Not just Sheet2 ?
Or
B. do you mean that the Sheet where the criteria text resides is fixed,
but the name of the sheet is definitely not Sheet2 ?
Yes you are correct that's why i am asking to select column.
if you provide VB input box i will give input of ex B5, A1, K4, means this will be me
header to make filter.
Ok... so, to the end-left from user selection in Sheet1 ---> this is the starting column of the table range.
And to the end-right from the user selection in Sheet1 ---> this is the end column of the table range.
For example :
the user choose cell H20 ...
So, cell H20 is the header to be filtered...
And so the starting table range column could be anything,
maybe it's cell A20 or cell B20 or C20 or D20 or E20 or F20 or even H20 itself.
And the last column of the table range also could be anything, maybe it's cell I20, J20, K20, or even maybe cell AA20.
Am I correct, Saran ?
Please try this :
The code is using a helper column in Sheet 2, which is column AA.
So please make sure that there is no data at all in column AA Sheet2.
The code assumes that the text of the criterias will be in Sheet2,
so before the code ask the user to select the criteria, the code activate Sheet2.
After the user select the criteria range, it copies the range to cell AA1 in Sheet2.
Then the code activate Sheet1, then ask the user to select the HEADER CELL to be filtered.
Based on the user selection, the code locate the starting column and the ending column of the table range.
The code will fail if there is a column in your table header which has no value.
The code also will fail if in the last column of the table range - there is a row with no value.
Bookmarks