我正在寻找一个公式或VBA代码,可以将条件格式,特别是填充颜色应用于包含特定文本的单元格左侧或右侧的空白单元格,其中包含:" P&# 34 ;.我已经附上了我想要实现的截图。
如果B列旁边的单元格包含以&#34开头的文字,我希望A列中单元格的填充颜色变为蓝色; P"如果文本是" T"等等,则为粉红色。
之前实现此目的的方法是使用宏来复制F列中的数据并将其粘贴到A,G,M列中,然后将条件格式应用于具有以下规则的列:Cell Value以"开头。 P",然后将填充颜色和文本更改为相同的颜色,以便显示为实心。
它的hacky但很有效,不幸的是在打印时,单元格的文本仍然会显示填充背景颜色。这不是世界末日,但我想知道是否有更正确的方法来实现这一目标。有没有办法来抵消格式适用的单元格?任何帮助表示赞赏谢谢!
答案 0 :(得分:0)
我要做的第一件事是通过公式生成一个定义名称>定义的名称>使用以下公式定义Name,名为Here:
Caused by: NoNodeAvailableException[None of the configured nodes are available: []]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207)
at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:288)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56)
at com.a.p.flink.AsyncESRequest.asyncInvoke(AsyncESRequest.java:54)
at com.a.p.flink.AsyncESRequest.asyncInvoke(AsyncESRequest.java:23)
at org.apache.flink.streaming.api.operators.async.AsyncWaitOperator.processElement(AsyncWaitOperator.java:230)
at org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.pushToOperator(OperatorChain.java:528)
at org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.collect(OperatorChain.java:503)
at org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.collect(OperatorChain.java:483)
at org.apache.flink.streaming.api.operators.AbstractStreamOperator$CountingOutput.collect(AbstractStreamOperator.java:891)
at org.apache.flink.streaming.api.operators.AbstractStreamOperator$CountingOutput.collect(AbstractStreamOperator.java:869)
at org.apache.flink.streaming.api.operators.StreamSourceContexts$NonTimestampContext.collect(StreamSourceContexts.java:103)
at org.apache.flink.streaming.api.operators.StreamSourceContexts$NonTimestampContext.collectWithTimestamp(StreamSourceContexts.java:110)
at org.apache.flink.streaming.connectors.kinesis.internals.KinesisDataFetcher.emitRecordAndUpdateState(KinesisDataFetcher.java:486)
at org.apache.flink.streaming.connectors.kinesis.internals.ShardConsumer.deserializeRecordForCollectionAndUpdateState(ShardConsumer.java:263)
at org.apache.flink.streaming.connectors.kinesis.internals.ShardConsumer.run(ShardConsumer.java:209)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
然后,在Home>下样式>条件格式>新规则,在您想要受影响的单元格上使用此公式:
=INDIRECT(ADDRESS(ROW(),COLUMN(),4))
答案 1 :(得分:0)
选择列A,F和M,其中F1为活动单元格。使用以下公式创建新的CFR。
=or(iferror(left(e1)="P", false), left(g1)="P")
在VBA中创建它的问题是公式; A列左侧没有列,三列的任何联合将始终将A1视为“活动单元格”,无论联合的创建方式如何。 .Range(“G:G,M:M,A:A,”)与.Range(“A:A,G:G,M:M”)相同; A1是'活跃细胞'。一种解决方案是暂时切换到xlR1C1,其中RC [-1]可用于引用A列左侧不存在的列。
Option Explicit
Sub meh()
Dim refStyle As Long, xlR1C1formula As String
'store original reference style
refStyle = Application.ReferenceStyle
'make it xlR1C1 reference style
Application.ReferenceStyle = xlR1C1
With Worksheets("sheet1")
With .Range("A:A, G:G, M:M")
.FormatConditions.Delete
xlR1C1formula = "=or(iferror(left(rc[-1])=char(80), false), left(rc[1])=char(80))"
With .FormatConditions.Add(Type:=xlExpression, Formula1:=xlR1C1formula)
.Interior.ColorIndex = 5
.NumberFormat = ";;;"
End With
xlR1C1formula = "=or(iferror(left(rc[-1])=char(84), false), left(rc[1])=char(84))"
With .FormatConditions.Add(Type:=xlExpression, Formula1:=xlR1C1formula)
.Interior.ColorIndex = 22
.NumberFormat = ";;;"
End With
End With
'switch back
Application.ReferenceStyle = refStyle
End With
End Sub