Solved

Excel - Macro hide columns not working

Posted on 2016-11-17
4
19 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
  • 2
4 Comments
 
LVL 45

Assisted Solution

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

Accepted Solution

by:
Norie earned 250 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 45

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now