ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 1437|回复: 8

用函数如何取颜色

[复制链接]

TA的精华主题

TA的得分主题

发表于 2015-7-28 08:43 | 显示全部楼层 |阅读模式
a
s
d
f
b
v
请问如何设置函数把相同颜色的筛选出来?

TA的精华主题

TA的得分主题

发表于 2015-7-28 09:09 | 显示全部楼层

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-7-28 10:49 | 显示全部楼层

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-7-28 11:15 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
下面如何在EXCEL里面操作

Function CellColor单元格颜色(rCell As Range, Optional ColorName As Boolean)
Dim strColor As String, iIndexNum As Integer

'Written by Dave Hawley of OzGrid.com
Select Case rCell.Interior.ColorIndex
   Case 1
    strColor = "Black"
    iIndexNum = 1
   Case 53
    strColor = "Brown"
    iIndexNum = 53
   Case 52
    strColor = "Olive Green"
    iIndexNum = 52
   Case 51
    strColor = "Dark Green"
    iIndexNum = 51
   Case 49
    strColor = "Dark Teal"
    iIndexNum = 49
   Case 11
    strColor = "Dark Blue"
    iIndexNum = 11
   Case 55
    strColor = "Indigo"
    iIndexNum = 55
   Case 56
    strColor = "Gray-80%"
    iIndexNum = 56
   Case 9
    strColor = "Dark Red"
    iIndexNum = 9
   Case 46
    strColor = "Orange"
    iIndexNum = 46
   Case 12
    strColor = "Dark Yellow"
    iIndexNum = 12
   Case 10
    strColor = "Green"
    iIndexNum = 10
   Case 14
    strColor = "Teal"
    iIndexNum = 14
   Case 5
    strColor = "Blue"
    iIndexNum = 5
   Case 47
    strColor = "Blue-Gray"
    iIndexNum = 47
   Case 16
    strColor = "Gray-50%"
    iIndexNum = 16
   Case 3
    strColor = "Red"
    iIndexNum = 3
   Case 45
    strColor = "Light Orange"
    iIndexNum = 45
   Case 43
    strColor = "Lime"
    iIndexNum = 43
   Case 50
    strColor = "Sea Green"
    iIndexNum = 50
   Case 42
    strColor = "Aqua"
    iIndexNum = 42
   Case 41
    strColor = "Light Blue"
    iIndexNum = 41
   Case 13
    strColor = "Violet"
    iIndexNum = 13
   Case 48
    strColor = "Gray-40%"
    iIndexNum = 48
   Case 7
    strColor = "Pink"
    iIndexNum = 7
   Case 44
    strColor = "Gold"
    iIndexNum = 44
   Case 6
    strColor = "Yellow"
    iIndexNum = 6
   Case 4
    strColor = "Bright Green"
    iIndexNum = 4
   Case 8
    strColor = "Turqoise"
    iIndexNum = 8
   Case 33
    strColor = "Sky Blue"
    iIndexNum = 33
   Case 54
    strColor = "Plum"
    iIndexNum = 54
   Case 15
    strColor = "Gray-25%"
    iIndexNum = 15
   Case 38
    strColor = "Rose"
    iIndexNum = 38
   Case 40
    strColor = "Tan"
    iIndexNum = 40
   Case 36
    strColor = "Light Yellow"
    iIndexNum = 36
   Case 35
    strColor = "Light Green"
    iIndexNum = 35
   Case 34
    strColor = "Light Turqoise"
    iIndexNum = 34
   Case 37
    strColor = "Pale Blue"
    iIndexNum = 37
   Case 39
    strColor = "Lavendar"
    iIndexNum = 39
   Case 2
    strColor = "White"
    iIndexNum = 2
  Case Else
    strColor = "Custom color or no fill"
End Select

        If ColorName = True Or _
                strColor = "Custom color or no fill" Then
                CellColor单元格颜色 = strColor
        Else
                CellColor单元格颜色 = iIndexNum
        End If

End Function

TA的精华主题

TA的得分主题

发表于 2015-7-28 13:56 | 显示全部楼层

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-7-28 14:19 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
好的,谢谢

TA的精华主题

TA的得分主题

发表于 2015-8-12 19:39 | 显示全部楼层
用countcolor, 编个自定义函数就可以了

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-8-18 17:01 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2015-8-21 08:54 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-5-23 17:04 , Processed in 0.033665 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

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