|
本帖最后由 yaozong 于 2012-11-17 07:31 编辑
Sub aaa() '添加或更新分表(有者更新/无者添加)
Application.ScreenUpdating = False
Sheet1.Activate
Dim cl As Range
For Each cl In Range("a5", [a65536].End(3))
On Error Resume Next
If Sheets(cl.Value) Is Nothing Then
Sheets("Sheet1").Copy After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = cl.Value
Sheets(cl.Value).[b2] = cl.Value
Else
Sheets(cl.Value).[b5].Resize(12, 1).ClearContents
End If
Sheets(cl.Value).[b5].Resize(12, 1) = Application.Transpose(cl.Offset(, 1).Resize(1, 12).Value)
Next
Sheet1.Select
Application.ScreenUpdating = True
End Sub |
|