|
Sub 生成表格()
Application.ScreenUpdating = False
With Sheets("数据表")
rs = .Cells(Rows.Count, 1).End(xlUp).Row
ar = .Range("a1:c" & rs)
End With
For i = 2 To UBound(ar)
If Trim(ar(i, 3)) <> "" Then
mc = ar(i, 3)
m = 0
For Each sh In Sheets(Array("沟槽开挖", "沟槽支护", "管道基础"))
m = m + 1
If m = 1 Then
sh.Copy
Set wb = ActiveWorkbook
With wb.Worksheets(1)
.[g12] = ar(i, 1)
.[s12] = ar(i, 2)
End With
Else
sh.Copy after:=wb.Worksheets(wb.Worksheets.Count)
With wb.Worksheets(wb.Worksheets.Count)
.[g12] = ar(i, 1)
.[s12] = ar(i, 2)
End With
End If
Next sh
wb.SaveAs Filename:=ThisWorkbook.Path & "\" & mc & ".xlsx"
wb.Close
End If
Next i
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
评分
-
1
查看全部评分
-
|