|
楼主 |
发表于 2004-9-21 15:41
|
显示全部楼层
<P>Sub 导入汇总表()
Dim k As Long, c As Range
If MsgBox("是否导入凭证信息汇总表?", vbYesNo) = vbNo Then Exit Sub '询问提示
With Sheets("凭证信息汇总") '以下代码前带点的都是对【凭证信息汇总】操作
k = .[d65536].End(xlUp).Row + 1 '【凭证信息汇总】D列最后行号
.Cells(k, 1) = [i2] '写入字号
.Cells(k, 2) = DateSerial([c2], [d2], [e2]) '日期
.Cells(k, 3) = [a5]
.Cells(k, 9) = [f11]
.Cells(k, 10) = [i11]
For Each c In [h5:h10] '对借方金额区循环
If c <> "" Then '借方不空
.Cells(k, 4) = c.Offset(0, -6)
.Cells(k, 5) = c.Offset(0, -5)
.Cells(k, 6) = c.Offset(0, -4)
.Cells(k, 7) = c
k = k + 1
ElseIf c.Offset(0, 1) <> "" Then '贷方不空
.Cells(k, 4) = c.Offset(0, -3)
.Cells(k, 5) = c.Offset(0, -2)
.Cells(k, 6) = c.Offset(0, -1)
.Cells(k, 8) = c.Offset(0, 1)
k = k + 1
End If
Next
End With
End Sub
<b>这是taller版主提供的代码,大家试试看,共同学习一下。</b></P> |
|