1 Sub Sheet3_按钮1_Click() 2 Dim sh As Worksheet, n%, i%, arr, s 3 n = ThisWorkbook.Sheets.Count '取得工作表总数' 4 ReDim arr(1 To n) '声明变量' 5 For Each sh In ThisWorkbook.Sheets '循环检查工作表表名' 6 If sh.Name <> ActiveSheet.Name Then 7 i = i + 1 8 arr(i) = sh.Name 9 s = s + " " + arr(i) 10 End If 11 Next 12 'MsgBox s 13 'End 14 If i > 0 Then 15 ReDim Preserve arr(1 To i) 16 ThisWorkbook.Sheets(arr).Select '组合工作表' 17 ActiveSheet.[B2:B11].Select '选择区域' 18 End If 19 End Sub
标签:ThisWorkbook,当前工作,arr,End,Sheets,sh,B2,B11 From: https://www.cnblogs.com/hnqyliu/p/17842326.html