¦U¦ì¤j¤j,
¤p§Ì¼g¤F1Ó²³æªºVBA¦Û¥Î, ¤£¹L¦³°ÝÃD¸Ñ¨M¤£¤F:'(
°ÝÃD1:
¦pªG±N¥H¤U³o¦æ
my_journal.Cells(i, 7) = my_voucher.Cells(Voucher_First_line, 3) + " " + my_voucher.Cells(Voucher_First_line, 4)
§ï¦¨
my_journal.Cells(i, 7) = my_voucher.Cells(Voucher_First_line, 3) + " " + my_voucher.Cells(Voucher_First_line, 5)
©Î
my_journal.Cells(i, 7) = my_voucher.Cells(Voucher_First_line, 3) + " " + my_voucher.Cells(Voucher_First_line, 4)+ " " + my_voucher.Cells(Voucher_First_line, 5)
´N¥X¿ù
°ÝÃD2:
¦pªG¦bPrint¨º±isheetªº (9,1), (9,2)¸Ì¶ñ¤J 1~3, «ç¼Ë¼gÓVBA¥ÑJournal¨º±isheetªº§ä´M¬ÛÃö¸ê®Æ, µM«á³v±i¦C¦L¥X¨Ó?
Á¤F
ìCode¥H¤U
Sub add_data()
Dim count_num As Integer, s, t As Integer
Dim LastRow As Long
Set my_voucher = Worksheets("Voucher")
Set my_journal = Worksheets("Journal")
With my_voucher
.Activate
s = .Cells(Rows.Count, 1).End(xlUp).Row 'Voucher²Ä1Ócolumn ¥Ñ¤U¦V¤Wªº³Ì«á¤@¦æ
End With
With my_journal
.Activate
t = .Cells(Rows.Count, 1).End(xlUp).Row 'Journal²Ä1Ócolumn ¥Ñ¤U¦V¤Wªº³Ì«á¤@¦æ
End With
Journal_First_line = t + 1 'Journal²Ä1Ócolumn ³Ì«á¤@¦æªº¤U¤@¦æ
count_num = s - 9 'Á`µ§¼Æ=²Ä1Ócolumn ³Ì«á¤@¦æ´î¼ÐÃD¦C¦æ
Voucher_First_line = 10 'Voucher²Ä1¦æ¬O²Ä10¦æ
For i = Journal_First_line To Journal_First_line + count_num - 1 'Journalªº²Ä1¦æªÅ®æ ¦Ü Journalªº²Ä1¦æªÅ®æ+voucherÁ`¦æ¼Æ-1
my_journal.Cells(i, 1) = my_voucher.Cells(4, 7) 'Voucher No
my_journal.Cells(i, 2) = my_voucher.Cells(Voucher_First_line, 1) 'Account Code
my_journal.Cells(i, 3) = my_voucher.Cells(Voucher_First_line, 2) 'Account Name
my_journal.Cells(i, 4) = my_voucher.Cells(5, 7) 'Date
my_journal.Cells(i, 5) = my_voucher.Cells(6, 7) 'Cheque No
my_journal.Cells(i, 6) = my_voucher.Cells(7, 7) 'Payer Name
my_journal.Cells(i, 7) = my_voucher.Cells(Voucher_First_line, 3) + " " + my_voucher.Cells(Voucher_First_line, 4) '¦X¨ÖParticular
my_journal.Cells(i, 8) = my_voucher.Cells(Voucher_First_line, 6) 'Dr
my_journal.Cells(i, 9) = my_voucher.Cells(Voucher_First_line, 7) 'Cr
Voucher_First_line = Voucher_First_line + 1
Next i
With my_voucher
.Activate
Cells(s + 1, 5).Value = "Á`¼Æ"
Cells(s + 1, 6).Formula = "=SUM(F10:F" & s + 1 - 1 & ")" '³Ì«á1¦æ¦V¥k²Ä4ªÅ¦ì
Cells(s + 1, 7).Formula = "=SUM(G10:G" & s + 1 - 1 & ")" '³Ì«á1¦æ¦V¥k²Ä5ªÅ¦ì
End With
End Sub |