pliskers
Active Member
- Joined
- Sep 26, 2002
- Messages
- 462
- Office Version
- 2016
- Platform
- Windows
I have a macro that inserts a blanks sheet in a workbook, then copies and pastes as values the entire contents of another sheet that has groupings in both rows and columns.
The code (which I did not write) appears below. Can someone have a look and please tell me why the groupings are not properly being copied into the newly inserted sheet? Ideally, I want all values, formats, and column widths to appear exactly the same in the copied worksheet.
Thank you!
Sheets("VPM").Select
Cells.Select
Selection.Copy
Sheets("Geog").Select
Cells.Select
ActiveSheet.Paste
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
Rows("8:8").Select
Selection.RowHeight = 100
Columns("A:A").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.Zoom = 75
ActiveWindow.DisplayGridlines = False
ActiveWindow.FreezePanes = False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=4
ActiveSheet.Outline.ShowLevels RowLevels:=2
Range("C12").Select
ActiveWindow.FreezePanes = True
Application.CutCopyMode = False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=1
The code (which I did not write) appears below. Can someone have a look and please tell me why the groupings are not properly being copied into the newly inserted sheet? Ideally, I want all values, formats, and column widths to appear exactly the same in the copied worksheet.
Thank you!
Sheets("VPM").Select
Cells.Select
Selection.Copy
Sheets("Geog").Select
Cells.Select
ActiveSheet.Paste
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
Rows("8:8").Select
Selection.RowHeight = 100
Columns("A:A").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.Zoom = 75
ActiveWindow.DisplayGridlines = False
ActiveWindow.FreezePanes = False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=4
ActiveSheet.Outline.ShowLevels RowLevels:=2
Range("C12").Select
ActiveWindow.FreezePanes = True
Application.CutCopyMode = False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=1