|
非常感谢EXCELHOME里的老师们!
你好~~~hzg7818
能帮我看一下这些代码吗?
我想把“附件”的张数即“凭证录制”表中AI14单元格也保存到“记账凭证分录汇总”的G列中又什么改代码呢?
Private Sub Co_保存_Click()
Dim a, arr, brr(1 To 6, 1 To 6), i%, j%, c As Range
Dim 编号$, 日期 As Date, m%
编号 = [BD4]
日期 = [AM4]
a = Array(1, 4, 7, 18)
arr = [AH8:BI13]
Set c = Sheets("记账凭证分录汇总").Range("b:b").Find(编号, , , xlWhole)
If Not c Is Nothing Then
MsgBox "该编号已存在!请检查"
Exit Sub
End If
With WorksheetFunction
For i = 1 To 6
If .CountA(Cells(i + 7, 34).Resize(, 28)) Then
m = m + 1
brr(m, 1) = 日期
brr(m, 2) = 编号
For j = 0 To 3
brr(m, j + 3) = arr(i, a(j))
Next
End If
Next
End With
Sheets("记账凭证分录汇总").[d65536].End(xlUp).Offset(1, -3).Resize(m, 6) = brr
End Sub
Private Sub Co_保存并打印_Click()
Dim a, arr, brr(1 To 6, 1 To 6), i%, j%, c As Range
Dim 编号$, 日期 As Date, m%
编号 = [BD4]
日期 = [AM4]
a = Array(1, 4, 7, 18)
arr = [AH8:BI13]
Set c = Sheets("记账凭证分录汇总").Range("b:b").Find(编号, , , xlWhole)
If Not c Is Nothing Then
MsgBox "该编号已存在!请检查"
Exit Sub
End If
With WorksheetFunction
For i = 1 To 6
If .CountA(Cells(i + 7, 34).Resize(, 28)) Then
m = m + 1
brr(m, 1) = 日期
brr(m, 2) = 编号
For j = 0 To 3
brr(m, j + 3) = arr(i, a(j))
Next
End If
Next
End With
Sheets("记账凭证分录汇总").[d65536].End(xlUp).Offset(1, -3).Resize(m, 6) = brr
Range("A2:AE16").PrintOut Copies:=1, Collate:=True
End Sub |
|