搜索
查看: 2245|回复: 0

数组中运算VBA

[复制链接]

977

主题

1093

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
15934
发表于 2018-12-31 16:13:53 | 显示全部楼层 |阅读模式
'在数组中求和,平均,最大,最小,极大,极小值等
Sub test()
arr = [b2:c9]
'MsgBox WorksheetFunction.Sum(arr)
'MsgBox WorksheetFunction.Average(arr)
'MsgBox WorksheetFunction.Max(arr)
'MsgBox WorksheetFunction.Min(arr)
'MsgBox WorksheetFunction.Small(arr, 2)
MsgBox WorksheetFunction.Large(arr, 2)
End Sub

Sub test2()
Dim arr1(1 To 99)
arr = [b2:c9]
For Each a In arr
    If a >= 80 Then
        n = n + 1
        arr1(n) = a
    End If
Next
MsgBox WorksheetFunction.Average(arr1)
End Sub


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

表格智创网

网站简介:表格智创网,是一家以表格设计和技能分享的专业社区,由会计帮帮网投资建设,尽专业,助提高专业技能。

表格智创网欢迎您!

联系我们

  • 工作时间:早上9:00-16:00
  • 客服电话:18668755857
  • 本站网址:www.excelwps.com
  • 淘宝店址:kjbbw.taobao.com

Powered by Discuz! X3.4 © 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表