|
![](https://clubstatic.excelhome.net/image/common/ico_lz.png)
楼主 |
发表于 2022-12-19 12:04
|
显示全部楼层
Sub 填充F及H列_Click()
Dim i, iCnt As Integer
iCnt = Cells(Rows.Count, 2).End(xlUp).Row
For i = 4 To iCnt Step 1
If Range("F" & i) = "" Then
Range("F" & i).FormulaR1C1 = "=IFERROR(MyCalN(RC[1],RC[2],RC[-3],RC[-2]),"""")"
End If
If Range("H" & i) = "" Then
Range("H" & i).FormulaR1C1 = "=IFERROR(Cxs(RC[-1],RC[-2],RC[-5],RC[-4]),"""")"
End If
If Range("L" & i) = "" Then
Range("L" & i).FormulaR1C1 = "=RC[-9]*RC[-8]*RC[-7]*RC[-6]/1000000000*R3C14"
End If
Next i
Dim n As Integer
n = Range("L" & Rows.Count).End(xlUp).Row
[L1] = WorksheetFunction.Sum(Range("L4:L" & n))
End Sub
可能还要加上判断 我F列和H列 数据不则 不是很规律 |
|