|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 拷贝()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With Sheets("企业所得税年度纳税申报表填报表单")
r = .Cells(Rows.Count, 2).End(xlUp).Row
ar = .Range("a2:c" & r)
End With
On Error Resume Next
For i = 3 To UBound(ar)
If ar(i, 3) = "√" Then
m = m + 1
mc = ar(i, 1) & ar(i, 2)
Sheets(mc).Copy after:=Sheets(Sheets.Count)
With ThisWorkbook.ActiveSheet
.UsedRange = .UsedRange.Value
If m = 1 Then
.Copy
Set wb = ActiveWorkbook
wb.Worksheets(1).Name = mc
Else
.Copy after:=wb.Worksheets(wb.Worksheets.Count)
wb.Worksheets(wb.Worksheets.Count).Name = mc
End If
.Delete
End With
End If
Next i
wb.SaveAs Filename:=ThisWorkbook.Path & "\拷贝文件.xlsx"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "ok!"
End Sub
|
|