|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub yy()
- arr = Sheet2.[a1].CurrentRegion
- For i = 4 To UBound(arr)
- Set whor = Workbooks.Open(ThisWorkbook.Path & "\模板.xlsx")
- With whor.Sheets("模板")
- ' .[c2] = arr(i, 1)
- .[f2] = arr(i, 2)
- .[d4] = arr(i, 3)
- .[e4] = arr(i, 4)
- .[f4] = arr(i, 5)
- .[g4] = arr(i, 6)
- .[d5] = arr(i, 7)
- .[e5] = arr(i, 8)
- .[f5] = arr(i, 9)
- .[g5] = arr(i, 10)
- .[d6] = arr(i, 11)
- .[e6] = arr(i, 12)
- .[f6] = arr(i, 13)
- .[g6] = arr(i, 14)
- .[d7] = arr(i, 15)
- .[e7] = arr(i, 16)
- .[f7] = arr(i, 17)
- .[g7] = arr(i, 18)
- .[d8] = arr(i, 19)
- .[e8] = arr(i, 20)
- .[f8] = arr(i, 21)
- .[g8] = arr(i, 22)
- .[d9] = arr(i, 23)
- .[e9] = arr(i, 24)
- .[f9] = arr(i, 25)
- .[g9] = arr(i, 26)
- .[d10] = arr(i, 27)
- .[e10] = arr(i, 28)
- .[f10] = arr(i, 29)
- .[g10] = arr(i, 30)
- .[d11] = arr(i, 31)
- .[e11] = arr(i, 32)
- .[f11] = arr(i, 33)
- .[g11] = arr(i, 34)
- .[d12] = arr(i, 35)
- .[e12] = arr(i, 36)
- .[f12] = arr(i, 37)
- .[g12] = arr(i, 38)
- .[d13] = arr(i, 39)
- .[e13] = arr(i, 40)
- .[f13] = arr(i, 41)
- .[g13] = arr(i, 42)
- .[d14] = arr(i, 43)
- .[e14] = arr(i, 44)
- .[f14] = arr(i, 45)
- .[g14] = arr(i, 46)
- .[d15] = arr(i, 47)
- .[e15] = arr(i, 48)
- .[f15] = arr(i, 49)
- .[g15] = arr(i, 50)
- .[c16] = arr(i, 53)
- .[c17] = arr(i, 54)
- .[e17] = arr(i, 55)
- .[g17] = arr(i, 56)
- .[c18] = arr(i, 57)
- .[f18] = arr(i, 58)
- .[b19] = arr(i, 59)
- .[b21] = arr(i, 60)
- For ii = 4 To 15
- If Cells(ii, 4) = "" Then Cells(ii, 1) = ""
- Next ii
- .SaveAs ThisWorkbook.Path & "\文件" & arr(i, 2) & ".xlsx"
- End With
- whor.Close 1
- Next i
- End Sub
复制代码
|
|