|
生成工作簿……
- Sub lkyy()
- Set d = CreateObject("Scripting.Dictionary")
- myr = Range("a10000").End(3).Row
- For i = 1 To myr Step 36
- If Cells(i, "p") <> "" Then d(Cells(i, "p").Value) = i
- Next
- If d.Count = 0 Then MsgBox "不存在": Exit Sub
- Application.DisplayAlerts = False
- Sheets.Copy after:=Sheets("Page1")
- ActiveSheet.Name = "复制"
- With Sheets("复制")
- .Range("a1:v" & myr).ClearContents
- .Range("a37:v" & myr).Borders.LineStyle = 0
- For Each shp In .Shapes
- If TypeName(shp) = "Shape" Then shp.Delete
- Next
- End With
- For i = 0 To d.Count - 1
- Set wb = Workbooks.Add
- wb.SaveAs ThisWorkbook.Path & "" & d.keys()(i) & ".xlsx"
- ThisWorkbook.Sheets("复制").Copy wb.Sheets(1)
- With wb.Sheets("复制")
- .Range("1:36").RowHeight = 20.75
- ThisWorkbook.Sheets("Page1").Cells(d.items()(i), 1).Resize(36, 22).Copy .[a1]
- .Name = d.keys()(i)
- End With
- wb.Close 1
- Next
- Set d = Nothing
- ThisWorkbook.Sheets("复制").Delete
- Application.DisplayAlerts = True
- End Sub
复制代码
|
|