Grouping Columns causing errors with other macros

Glove_Man

Well-known Member
Joined
Feb 20, 2005
Messages
578
G'Day all,

I have a macro which downloads some data into some pre-arranged cells and then formats some graphs which are linked to those cells.

Since I need to display the resultant graphs in a weekly presentation, I have grouped the columns where the data is downloaded (A to AB).

The idea is that I will hide the data when I make the presentation. However, if you run the macro with the columns hidden, you receive errors. When the columns are not hidden, you don't.

Essentially, what is the command that unhides the columns?

Is it something like:
Columns("A:AB").unhide
or
Groups("Group1").visible = true

Thanks

Philby
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Add your lines of code to ungroup your columns to your download and format code. Then at the end, add the lines of code to re-group your columns.
 

Glove_Man

Well-known Member
Joined
Feb 20, 2005
Messages
578
I got it to work, thanks.

But does anyone know if there's a way to control the +/- buttons you get along the top of the spreadsheet from inside VBA?

Philby
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
This code is for Grouping and ungrouping ROWs. Columns should be similar;
Code:
    ActiveSheet.Outline.ShowLevels RowLevels:=2
    ' or
    ActiveSheet.Outline.ShowLevels RowLevels:=1
 

Forum statistics

Threads
1,181,658
Messages
5,931,268
Members
436,785
Latest member
KingGideon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top