Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel - Macro hide columns not working

Posted on 2016-11-17
4
Medium Priority
?
185 Views
Last Modified: 2016-11-17
Hi Experts,
I have a worksheet that I need to hide certain columns with a macro, and with a second macro hide other columns.
But when ever I try to set the macro to even hide ONE column, it hides the entire table.

Once the macro works then I will need to select the first row, the table, and the last row to fit onto one landscape 8.5 by 11 sheet of paper.

The second macro will also do the same but with a different combination of columns selected.

There is one row above the table and on row under that I will also need to include to print.
When ever I try to macro one column it hides all columns A through AH which is the entire table.

Thanks so much

I have attached the dummy file./
dummy.xlsm
0
Comment
Question by:chris pike
[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
  • 2
4 Comments
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 1000 total points
ID: 41891943
ActiveSheet.Range("C1").EntireColumn.Hidden = True
0
 
LVL 35

Accepted Solution

by:
Norie earned 1000 total points
ID: 41891964
The problem is the merged cells in row 38, either unmerge those cells or try something like this.
Sheets("Main file").Columns(3).EntireColumn.Hidden = True

Open in new window

0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 41892024
either unmerge those cells or try something like this
Or my solution which has exactly the same effect.
0
 

Author Closing Comment

by:chris pike
ID: 41892175
Thank you very much.
I didn't know that a merged cell would mess up the columns.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

636 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