|
Sub ff()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
With Sheets("总表")
For i = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
If SheetExists(.Cells(i, 1).Value) = False Then
Sheets.Add.Name = .Cells(i, 1).Value
End If
Next
End With
End Sub
Function SheetExists(sname) As Boolean
' 判断活动工作簿中某个工作表是否存在,例如,【SheetExists("小明"),返回True表示存在】【SheetExists("小"),返回False表示不存在】
Dim x As Object
On Error Resume Next '根据错误判断工作表是否存在,如果存在则不报错,反之报错
Set x = ActiveWorkbook.Sheets(sname)
If Err = 0 Then SheetExists = True _
Else SheetExists = False
End Function
|
评分
-
1
查看全部评分
-
|