|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub sjlu()
With Sheets("收缴数据录入")
lh = .[d5]
sh = .[g5]
lh = .[d5]
bh = .[d3]
ks = .[g7]
js = .[i7]
je = .[d9]
End With
ys = DateDiff("m", [g7], [i7]) + 1
pjs = je / ys
Dim rn As Range
With Sheets(lh)
r = .Cells(Rows.Count, 1).End(xlUp).Row
Set rn = .Range("b2:b" & r).Find(sh, , , , , , 1)
If rn Is Nothing Then MsgBox lh & "工作表内找不到" & sh & "数据": End
w = rn.Row
ksn = Year(ks)
jsn = Year(js)
For i = ksn To jsn
nf = i & "年"
For j = 8 To 189
If .Cells(1, j) = nf Then
For s = j + 1 To j + 12
.Cells(w, s) = pjs
Next s
End If
Next j
Next i
End With
MsgBox "ok!"
End Sub
|
|