Sub test() n = Worksheets.Count For i = 1 To n Worksheets(i).Activate Macro1 Next End Sub Macro1是宏的名称