VBA:錄製公式
With Sht1.Range("Y" & xRow)
.FormulaR1C1 = "=IF(COUNT(RC[-24]:RC[-3]),INDEX(R10C[-24]:R10C[-3],MATCH(MAX(RC[-24]:RC[-3]),RC[-24]:RC[-3],)),"""")"
.Value = .Value
End With
With Sht1.Range("Z" & xRow)
.FormulaR1C1 = "=IF(COUNT(RC[-25]:RC[-4]),INDEX(R10C[-25]:R10C[-4],MATCH(MIN(RC[-25]:RC[-4]),RC[-25]:RC[-4],)),"""")"
.Value = .Value
End With
或者:
With Sht1.Range("Y" & xRow)
.Formula = Replace("=IF(COUNT(A11:V11),INDEX(A10:V10,MATCH(MAX(A11:V11),A11:V11,)),"""")", 11, xRow)
.Value = .Value
End With
With Sht1.Range("Z" & xRow)
.Formula = Replace("=IF(COUNT(A11:V11),INDEX(A10:V10,MATCH(MIN(A11:V11),A11:V11,)),"""")", 11, xRow)
.Value = .Value
End With作者: corcovado886 時間: 2015-11-8 12:07