Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1550|回复: 4

[已解决]关于EXCEL 表 VBA的问题

[复制链接]
发表于 2017-6-30 09:46 | 显示全部楼层 |阅读模式
我在表中使用了模块 计算单列中 单元格按不同填充色自动汇总
Function CountColor(col As Range, countrange As Range) As Integer
Dim icell As Range
Application.Volatile
For Each icell In countrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
CountColor = CountColor + 1
End If
Next icell
End Function
Function SumColor(col As Range, sumrange As Range) As Integer
Dim icell As Range
Application.Volatile
For Each icell In sumrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
SumColor = Application.Sum(icell) + SumColor
End If
Next icell
End Function
在单元格数值 小于40000时 没有问题 可以计算 单元格数值 大于40000时 则出现错误
有谁能说明一下为什么会出现 这种问题吗?怎么解决?[url=]收起[/url]
我用是的2010 版本
最佳答案
2017-6-30 15:41
As Integer
改为
As long
发表于 2017-6-30 15:41 | 显示全部楼层    本楼为最佳答案   
As Integer
改为
As long
回复

使用道具 举报

 楼主| 发表于 2017-6-30 16:03 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2017-6-30 16:07 | 显示全部楼层
顺便问下   可以实现   改变颜色  汇总值自动更改吗?
回复

使用道具 举报

发表于 2017-6-30 16:33 | 显示全部楼层
可以,最好用少量数据做一个测试文件,并手动给出相应结果。

这样,别人才好理解和回复。
回复

使用道具 举报

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

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-26 18:10 , Processed in 0.845736 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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