我使用的是Excel 2013,
我用了两种方式的大公式VBA,但不工作,我错了,我不知道
Sub Macro1()
'1st Table Dim statement ---> Declares variables
Dim lRow As Long, lCol As Long
lRow = Range("D5").End(xlDown).Row
lCol = Range("C5").End(xlToRight).Column
'Column Count in Number
Dim k As Long, m As Long
k = Range("C5", Range("C5").End(xlToRight)).Columns.Count
'Row Count in Number
m = Range("D6", Range("D6").End(xlDown)).Rows.Count
Dim MyRange As Range
Set MyRange = Range(Range("D5").Offset(1, k + 3), Range("D5").Offset(m, k + 3))
Range("D5").Offset(2, 1 + 3).Formula = "=LARGE(" & MyRange & ",1)"
'And
'=(LARGE($I$6:$I$12,1)-I7)/2
Range("D5").Offset(2, 1 + 3).Formula = "=(LARGE(" & MyRange & ",1)-" & Range("D5").Offset(1, k + 3) & ")/2"
End Sub
请帮帮我,谢谢你的预付款
1条答案
按热度按时间bmp9r5qi1#
您需要将范围的地址追加到公式中: