Sub AddTitle(ByVal sht As Worksheet) '第一步插入行 sht.Rows("1:1").Insert Shift:=xlDown '第二步合并单元格 With sht.Range("A1:D1") .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Merge '第三步 输入标题内容 .FormulaR1C1 = "批量添加的标题" '第四步 设置字体加粗 字号 .Font.Bold = True .Font.Size = 16 End With End Sub Sub AddTitleForAll() '声明变量 Dim sht As Worksheet '循环所有工作表 For Each sht In ThisWorkbook.Worksheets '对名称含有-的工作表进一步操作 If InStr(sht.Name, "-") > 0 Then Call AddTitle(sht) End If Next sht '释放对象 Set sht = Nothing End Sub