標題:
[發問]
怎樣將DATA (Sheet 2)的數據搬去INVOICE(Sheet 1)後逐頁列印
[打印本頁]
作者:
Hero2013
時間:
2013-8-9 11:14
標題:
怎樣將DATA (Sheet 2)的數據搬去INVOICE(Sheet 1)後逐頁列印
各位大大,
小弟又有問題請教囉;P
怎樣將DATA (Sheet 2)的數據搬去INVOICE(Sheet 1)後逐頁列印 ???
感激:P
作者:
Hsieh
時間:
2013-8-9 13:49
回復
1#
Hero2013
Sub PrintData()
With 工作表2
ar = .Range("A1").CurrentRegion
r = 3
Do Until r > UBound(ar, 1)
With 工作表1
.[B8] = ar(r, 11)
.[C13] = ar(r, 13)
.[B15:B18] = Application.Transpose(Array(ar(r, 2), ar(r, 15), ar(r, 16), ar(r, 17)))
' .PrintOut '列印
.PrintPreview '預覽列印
End With
r = r + 1
Loop
End With
End Sub
複製代碼
作者:
Hero2013
時間:
2013-8-10 00:35
Hsieh 大大,
謝謝你的回覆, 不過似乎出現Error.
然後小弟就自己嘗試寫, 不如只印了4張, 不知為啥呢:'(
找了很久也找不出原因...............
Sub INV()
Dim i As Integer, R As Integer
Set my_invoice = Worksheets("INVOICE")
Set my_data = Worksheets("PRINT")
With Worksheets("PRINT")
.Activate
R = .Cells(Rows.Count, 1).End(xlUp).Row
End With
i = 3
Do While i <= R
my_invoice.Cells(10, 3) = my_data.Cells(i, 11)
my_invoice.Cells(16, 5) = my_data.Cells(i, 13)
my_invoice.Cells(18, 2) = my_data.Cells(i, 19)
my_invoice.Cells(19, 4) = my_data.Cells(i, 2)
my_invoice.Cells(20, 4) = my_data.Cells(i, 15)
my_invoice.Cells(21, 4) = my_data.Cells(i, 16)
my_invoice.Cells(22, 4) = my_data.Cells(i, 17)
my_invoice.Cells(23, 4) = my_data.Cells(i, 18)
my_invoice.PrintOut
i = i + 1
Loop
End Sub
作者:
Hsieh
時間:
2013-8-12 09:25
回復
3#
Hero2013
[attach]15759[/attach]
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)