?
Solved

Excel VBA - Hiding all Columns in a Named Range

Posted on 2016-10-24
7
Medium Priority
?
60 Views
Last Modified: 2016-10-24
I have a named range called "HideTheseColumns". It is 5 rows by 10 columns (say). I'm looking for an elegant way of coding a 'hide columns' procedure.

This code didn't work.
Range("HideTheseColumns").Columns.EntireColumn.Hidden = False

Open in new window


Thanks
0
Comment
Question by:hindersaliva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 35

Accepted Solution

by:
Norie earned 1600 total points
ID: 41857577
Try this.
Range("HideTheseColumns").EntireColumn.Hidden = True

Open in new window

0
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 400 total points
ID: 41857578
Range("HideTheseColumns").Columns.EntireColumn.Hidden = True
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 41857579
Beaten by 41 seconds:(
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:hindersaliva
ID: 41857583
Haha! That's what I had BUT ........ I put 'False' and expecting the columns to hide! Doh!

Thanks!
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 41857587
Please don't forget to give Norie the credit when you close this question.
0
 

Author Comment

by:hindersaliva
ID: 41857589
BTW they both work, ie. with 'Columns' and without.
0
 

Author Closing Comment

by:hindersaliva
ID: 41857590
Thanks both of you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question