|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 新建工作表()
Application.ScreenUpdating = False
Dim ar As Variant, br As Variant
Application.DisplayAlerts = False
For Each sh In Sheets
If sh.Index > 2 Then
sh.Delete
End If
Next sh
Application.DisplayAlerts = True
With Sheets("名单")
r = .Cells(Rows.Count, 2).End(xlUp).Row
ar = .Range("b7:b" & r)
rs = .Cells(Rows.Count, 3).End(xlUp).Row
br = .Range("c7:c" & rs)
xm = .[b3]
bm = .[b2]
zw = .[b5]
End With
Sheets("原始表").Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = xm & "直接上级填写测试"
sl = r - 7
ls = 8 + sl
lh = Chr(ls + 64)
.Columns("I:" & lh).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
.Cells(5, 8).Resize(1, sl + 1) = "评分"
.Cells(6, 8).Resize(1, sl + 1) = Application.Transpose(ar)
End With
Sheets("原始表").Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = xm & "间接上级填写测试"
sl = rs - 7
ls = 8 + sl
lh = Chr(ls + 64)
.Columns("I:" & lh).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
.Cells(5, 8).Resize(1, sl + 1) = "评分"
.Cells(6, 8).Resize(1, sl + 1) = Application.Transpose(br)
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|