chris pike
asked on
Excel to show only slected columns and hide the rest
Hi Experts,
I want to be able to choose ONE column and also have L and M columns shown. Column A,B,C will always be visable.
Example: User want to display Column "D", they would enter "D" into the field B2 and the sheet would hide Everything except "D" and "L" and "M".. Also keep in mind that "D" could be any column chosen.... E or F or G etc..
L and M of course will change later as the sheet grows.
I wish slicers could work this way across rows.
Book3.xlsx
I want to be able to choose ONE column and also have L and M columns shown. Column A,B,C will always be visable.
Example: User want to display Column "D", they would enter "D" into the field B2 and the sheet would hide Everything except "D" and "L" and "M".. Also keep in mind that "D" could be any column chosen.... E or F or G etc..
L and M of course will change later as the sheet grows.
I wish slicers could work this way across rows.
Book3.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this line is to restrict
If Target >= 1 And Target <= 8 Then
the columns to be chosen
Range("C1").Offset(, Target.Value).EntireColumn
with offset displacing the position of the range ( definition Offset(Rows, Columns))
I could have written instead
Columns("D:D").Offset(, Target.Value - 1)
If Target >= 1 And Target <= 8 Then
the columns to be chosen
Range("C1").Offset(, Target.Value).EntireColumn
with offset displacing the position of the range ( definition Offset(Rows, Columns))
I could have written instead
Columns("D:D").Offset(, Target.Value - 1)
ASKER
Awesome.
I have another fix I would like to be made.
Please see next question.
Thanks so much.
Chris
I have another fix I would like to be made.
Please see next question.
Thanks so much.
Chris
ASKER
What is the C1 for and what is the <= 8 for?
The sheet will grow and it will have 60 or 70 columns of data, I need to change it easily.
Plus I love trying seeing how it works and trying to understand your coding, looks so simple.
Thanks so much
Chris
I have 2 other open questions.... wink wink