|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub cfbb()
Application.ScreenUpdating = False
Dim d As Object
Set d = CreateObject("scripting.dictionary")
'Call CreateFolderAndFile
With Sheets("参数表")
r = .Cells(Rows.Count, 2).End(xlUp).Row
If r < 2 Then MsgBox "参数表为空!": End
ar = .Range("a1:b" & r)
lj = ThisWorkbook.Path & "\" ' "E:\圆天缘张宝葵\报告报表\集团公司\2024年度\" & .Range("F2").Value & "\"
End With
For i = 2 To UBound(ar)
If ar(i, 2) <> "" Then
zd = Split(ar(i, 2), "月")(1)
d(zd) = i
End If
Next i
For Each sh In ThisWorkbook.Worksheets
If sh.Name <> "参数表" Then
zf = sh.Name
xh = d(zf)
If xh <> "" Then
sh.Copy
Set wb = ActiveWorkbook
With wb.Worksheets(1)
.UsedRange = .UsedRange.Value
End With
wb.SaveAs Filename:=lj & ar(xh, 2) & ".xlsx"
wb.Close
End If
End If
Next sh
Application.ScreenUpdating = True
End Sub |
|