excel - 如何检索条件格式单元格的背景颜色?
问题描述
我正在尝试查找有条件格式化的单元格的背景颜色。定义的功能代码如下,如果我手动为单元格着色,它可以工作,但如果应用条件格式,它会返回一个代码,就像单元格具有标准的白色背景一样。
我正在尝试使用此功能来应用基于该背景颜色的附加条件格式。
Function IdentifyColor(CellToTest As range)
'Returns R + (256 * G) + (65536 * B)
'IdentifyColor = 255 for red, 65280 for green, etc.
IdentifyColor = CellToTest.Interior.ColorIndex
End Function
这是带有手动和条件格式单元格以及返回值的工作表的样子:
解决方案
推荐阅读
- powershell - 是否有一些代码可以创建文件共享快照并在与 Azure 自动化约定时间后删除其中一些?
- php - 我的产品变体以数组形式出现 我需要调节它们的功能
- xamarin - Xamarin 表单底部选项卡栏上的圆形图标或按钮
- mysql - 转义变量mysql密码
- php - 使用静态 php 变量的这段代码有什么问题
- ios - ionic iOS FCM 在开发模式下工作,但在生产模式下不工作
- php - Laravel 5.7:找不到类“App\Http\Controllers\MailableClass”
- node.js - 将 DialogflowConversation 与 Fulfillment SDK 集成时出现异常
- linux - 错误:无法确定该 component.ts 的 /path 中的 SomeComponent 类的模块!将 SomeComponent 添加到 NgModule 以修复它
- java - 将 2 个 Arraylists 添加到 1 个 Recyclerview