惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - 飘翎

25天,能够做什么呢? ZZ 时间管理GTD-三学期完成双学位的秘密 Lane翻译,zz zz 节选自wikipedia about data analysis zz Data Analysis Process zz:What Does a Data Analyst Do? zz Data Analyst-Sample Resume - Resume Writing zz: A Data Analyst's Typical Day ZZ:Business Analysis Career Path 转:一个牛人的CV 转:How Do I Write a Business Analyst Resume? zz Excel删除重复数据、重复行(2003&2007) Edraw Max 试用心得 springSide 开始之旅 抖抖灰,重新开博 得大解脱,有小便宜 新年了,我也来kuso一下.......(yy帖~~) 找工作,攒人品(4) 2006年第一帖,庆祝自己找到wands的歌曲(转的哦~~)
在Excel中根据背景颜色来计算数据
飘翎 · 2009-12-28 · via 博客园 - 飘翎

第一次用Excel的宏,挺好玩。找了点资料。

原帖在 http://club.excelhome.net/viewthread.php?tid=81978&extra=&page=3

也有代码下载,我就不提供了。

我用的版本是03

步骤:

1.打开Excel, Alt+F11 打开VBA宏编辑器,新建一个模块,并在里面定义一个VBA函数。

代码

Function Countcolor(col As Range, countrange As Range)
 
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

2.该函数有2个参数,Para1的作用是做为背景颜色来比对,而Para2是统计的区域。

3.在Excel Sheet Cell中引用

=Countcolor(B$1,$A$1:$A$65535)

注意事项:

1. 如果不能运行,请查看宏的安全设置:工具->选项->安全->将安全级别降到中。

2.在VBA宏中,有Excel对象和模块定义。该函数需要在模块中定义,否则不能运行。因为带定义的需要在模块中才能定义。