我使用了下面提到的VBA代码并在此处收到错误:
Selection.Columns.Group
Sub Macro()
Dim wb As Workbook
Dim wb0 As Workbook
ThisWorkbook.Activate
cmnth = Sheet1.Range("AQ1").Value
pmnth = Sheet1.Range("AR1").Value
pmnthf = Sheet1.Range("AS1").Value
cfile = Sheet1.Range("C1").Value & "\TB_Trust-CC_" & cmnth & ".xlsx "
pfile = Sheet1.Range("C2").Value & "\TB_Trust-CC_" & pmnth & ".xlsx "
Set wb0 = Workbooks.Open(pfile)
Set wb = Workbooks.Open(cfile)
wb.Activate
For i = 4 To 12
cc = ThisWorkbook.Sheets("Macro").Range("C" & i).Value
ActiveWorkbook.Sheets(cc).Activate
Columns("E:AR").Select
Selection.Columns.Group
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
ThisWorkbook.Sheets("Macro").Columns("H:AN").Copy
Range("AT1").Select
ActiveSheet.Paste