代码测试通过。。。- Sub ykcbf() '//2024.2.3 一体化导入工资表
- Application.ScreenUpdating = False
- yf = Val(InputBox("请输入要生成一体化工资导入表月份:", "输入月份数...", 2))
- If yf = 0 Then Exit Sub
- Dim tm: tm = Timer
- On Error Resume Next
- Set Sh = Sheets(CStr(yf))
- arr = Sh.UsedRange
- ReDim brr(1 To UBound(arr), 1 To 100)
- ar = [{1,2,3,8,9,10,12,15,17,25,33,40,41,42,43,44,45,50,51}] '//sh表取值列号
- br = [{3,99,34,8,7,12,11,15,14,9,10,18,22,20,23,17,19,24,21}] '//sh表取值列号对应的月份表相应列号
- For i = 5 To UBound(arr)
- m = m + 1
- For x = 1 To UBound(ar)
- brr(m, ar(x)) = arr(i, br(x))
- Next
- brr(m, 2) = "1-居民身份证"
- brr(m, ar(6)) = brr(m, ar(6)) + arr(i, 13) '//绩效工资=基础绩效+奖励绩效
- Next
- With Sheets("一体化导入工资表")
- .UsedRange.Offset(3).Clear
- .Columns(3).NumberFormatLocal = "@"
- .[a4].Resize(m, 52) = brr
- .[a4].Resize(m, 52).Borders.LineStyle = 1
- End With
- Application.ScreenUpdating = True
- MsgBox "共用时:" & Format(Timer - tm) & "秒!"
- End Sub
复制代码
|