Excel总VBA相关类模块
生活随笔
收集整理的這篇文章主要介紹了
Excel总VBA相关类模块
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
VBA操作Excel類模塊的綜合運用:
Public 條件 Private rngs Private n Dim cc Property Set 單元格(rng As Range) If rng > 條件 Thenn = n + 1If n = 1 Then Set rngs = rngSet rngs = Union(rngs, rng) End Ifcc = rngs.Address End PropertyFunction 求和() 求和 = WorksheetFunction.Sum(rngs) End FunctionFunction 最大值() 最大值 = WorksheetFunction.Max(rngs) End FunctionFunction 最小值() 最小值 = WorksheetFunction.Min(rngs) End FunctionFunction 平均值() 平均值 = WorksheetFunction.Average(rngs) End FunctionFunction 極大值(k As Integer) 極大值 = WorksheetFunction.Large(rngs, k) End FunctionFunction 極小值(k As Integer) 極小值 = WorksheetFunction.Small(rngs, k) End Function類模塊調用:
Sub test() Dim dd As New 類1 For Each rn In [a1:a9] dd.條件 = 4 Set dd.單元格 = rn Next MsgBox dd.極小值(3)End Sub總結
以上是生活随笔為你收集整理的Excel总VBA相关类模块的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js 通过正则表达式验证身份证格式
- 下一篇: 爬虫抓包问题全面分析