excel - 我如何将条件格式应用于单元格的值而不是该值的外观?
问题描述
正如标题所示,我正在处理条件格式问题。
条件格式允许我根据公式更改单元格的外观(填充颜色、文本颜色),但是有什么方法可以更改文本本身?
编辑:具体来说,我在 Sheet1 B1:B100 中有一个单元格位置列表,在 Sheet 2 上有一个数组 (A1:Z26) 引用这些位置。在条件格式中使用以下论坛,
=MATCH(CELL("address",A1),Sheet2!$B:$B,0)
然后,我希望单元格(如果为 TRUE)更改(可能通过 INDEX/MATCH),以在同一行的不同列 A 中显示工作表 1 上的值。
例如,如果工作表 1,A1=John Smith B1=$Z$26,那么工作表 2 的 Z26 将 =“John Smith”。
解决方案
I was able to do it with the following custom function entered in every cell in the range Sheet2!$A$1:$Z$26
, like so: =Findvalue(Sheet1!$B$1:$B$26)
, with the below data entered into sheet1
Function FindValue(ByVal searchRange As Range)
Dim formulaInCell As Range
Dim cll As Range
Set formulaInCell = Application.Caller
Set cll = searchRange.Find(What:=formulaInCell.Address, lookat:=xlWhole)
If cll Is Nothing Then
FindValue = ""
Else
Set cll = cll.Offset(0, -1)
FindValue = cll.Value
End If
End Function
推荐阅读
- php - 使用 Zend i18n 和 Gettext 适配器时是否可以获得所有已加载的语言环境?
- assembly - 我对这个装配循环的理解是否正确?
- apache-flink - Flink 连接被拒绝:localhost/127.0.0.1:8081
- python - Django:查找以相同单词开头的参数数量
- javascript - 在没有本地存储的情况下存储数据或只执行一次操作(刷新)
- javascript - 遍历 JavaScript 对象
- vue.js - 在对象内使用三元运算符来定义它的属性
- postgresql-9.4 - postgres 节点上的所有可用 RAM 都被缓存
- java - 你怎么能锁定一个 JTextFeild 只接受数值和小数
- java - Spark Streaming:多次聚合数据流