关于自动生成工作表或工作薄的问题
Private Sub 生成_Click()
Application。ScreenUpdating = False
Application。DisplayAlerts = False
lastrow1 = [k65536]。 End(xlUp)。Row
lastrow2 = [b65536]。End(xlUp)。Row
Set sh1 = Sheets("报审表")
Set sh2 = Sheets("附件")
For i = lastrow1 + 1 To lastrow2
With sh1
。 Cells(5, "f") = Cells(i, "b")
。Cells(5, "i")...全部
Private Sub 生成_Click()
Application。ScreenUpdating = False
Application。DisplayAlerts = False
lastrow1 = [k65536]。
End(xlUp)。Row
lastrow2 = [b65536]。End(xlUp)。Row
Set sh1 = Sheets("报审表")
Set sh2 = Sheets("附件")
For i = lastrow1 + 1 To lastrow2
With sh1
。
Cells(5, "f") = Cells(i, "b")
。Cells(5, "i") = Cells(i, "c")
。Cells(5, "l") = Cells(i, "d")
。
Cells(7, "d") = Cells(i, "e")
End With
With sh2
。Cells(3, "g") = Cells(i, "b")
。
Cells(3, "i") = Cells(i, "c")
。Cells(3, "k") = Cells(i, "d")
For k = 6 To 10
。
Cells(5, k - 4) = Cells(i, k)
Next
End With
myname = Replace(Trim(Cells(i, "e")), "、", "")
Sheets(Array("报审表", "附件"))。
Copy
ActiveWorkbook。UpdateLinks = xlUpdateLinksNever
ActiveWorkbook。SaveAs Filename:=ThisWorkbook。
Path & "\报审表\" & myname
ActiveWorkbook。Close
Cells(i, "k") = "已经生成报审表"
Next i
Application。
ScreenUpdating = True
Application。DisplayAlerts = True
End Sub
。收起