max*_*465 2 excel vba worksheet excel-vba user-defined-functions
有用户定义的函数(UDF),它位于工作簿的所有工作表上.
如何查看函数所在的工作表?
我正在使用ThisWorkbook.ActiveSheet
,但结果不断变化.
Function äëÿñèò(Diapozon As Range) As Long
'äëÿ ñèòóàöèè
Application.Volatile
Dim n As Long
Dim C As Range
Dim m As Long
m = -1
n = 0
For Each C In Diapozon.Rows
If C.Value = 1 Then
m = m + 1
If ThisWorkbook.ActiveSheet.Cells(101, 42 + (m * 21)).Value = 1 Then
n = n + 1
End If
End If
Next C
äëÿñèò = n
End Function
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
219 次 |
最近记录: |