|
- Sub 测试()
- Dim i%, j%
- i = Cells(Rows.Count, "c").End(xlUp).Row
- For j = 2 To i
- Sheets("模板").Range("a5:e7").ClearContents
- Sheets("模板").Cells(5, 1) = Format(Cells(j, 1), "yyyy/mm/dd")
- Sheets("模板").Cells(5, 2) = Cells(j, 3)
- Sheets("模板").Cells(5, 3) = Cells(j, 1) & Cells(j, 3) & "走访" & Cells(j, 2)
- Sheets("模板").Cells(5, 4) = Cells(j, 5)
- Workbooks.Add
- ThisWorkbook.Sheets("模板").Cells.Copy ActiveWorkbook.Sheets(1).Range("a1")
- ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "" & "第" & j - 1 & "次走访.xls"
- ActiveWorkbook.Close
- Next j
- End Sub
复制代码 数据源是放sheet1中,不晓得是不是这个意思。
|
|