Cell Grouping with VBA

Pyromantic

Board Regular
Joined
Aug 9, 2006
Messages
58
I'm having a bit of problem with some code. The code perfoms 2 takens, deleting a bunch of sheets and minimising the cell group levels. When these actions are performed separately in differen't macros, they work just fine but as soon as i put them into the same peice of code, the macro bombs as soon as i try to minimise the groups.

Code:
Sub Macro4()
    Application.DisplayAlerts = False
    Sheets(Array("Introsheet", "Single Account Query", "Multi Account Query", _
        "Function Query", "COA", "ACL P&L", "Deptid", "Accounts", "Products", "Macros", _
        "Trial Balance")).Delete
    Sheets("P&L INPUT SHEET").Outline.ShowLevels RowLevels:=1
    Application.DisplayAlerts = True
End Sub

Thanks for reading
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Hello Pyromantic,
Your code is working as expected for me.
What error do you get when in bombs out?
 

Pyromantic

Board Regular
Joined
Aug 9, 2006
Messages
58
I'm not getting an error at all, the macro merely stops as the group minimising step. I know this because I've tried placing code after this step and it won't execute the additional code.

hmm, I am using a custom addin that allows me to interface directly into our accounting system through excel I wonder if that impacts it.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,061
Messages
5,545,763
Members
410,704
Latest member
Cobber2008
Top