我在Excel中有如下数据,我想在这里显示两件事

我在Excel中有如下数据,我想在这里显示两件事,excel,excel-formula,conditional,excel-2010,conditional-formatting,Excel,Excel Formula,Conditional,Excel 2010,Conditional Formatting,我在Excel中有如下数据,我想在这里显示两件事 1如果尿素柱H=-则柱B应改变颜色 2如果MR+,VP应自动作为- SLNo SID RV TT BSA XLD Lact. Urea TSI Ind. MR VP Cit. Nitrate Oxid ONPG PCR SALM? S

我在Excel中有如下数据,我想在这里显示两件事

1如果尿素柱H=-则柱B应改变颜色

2如果MR+,VP应自动作为-

SLNo SID RV TT BSA XLD Lact. Urea TSI Ind. MR VP Cit. Nitrate Oxid ONPG PCR SALM? S B H2S G R 1 R.13 + K A - - + - + - + - - - 2 5 TB - K K - - + - + - + - - 3 7.3R + K A - - + - + - + - - + 4 11.1R + K A + - + - + - + - - 5 15 + K A - - + - + - + - - 6 16.2RB - K + - + - + - D - - 7 18.04 - K K - - + - + - + - - - 8 18.1R K K - - + - - - + + - - 9 20.2R K A - - + - + - + - - + 10 20.3T - K A - - + - + - + - - + 11 R3D/ 28.1- K + - + - + - - -- - + + 答复1: 我使用了条件格式选项和=isnumbersarch5,-,这是可行的,但问题是尿素列中的空白也突出显示了颜色

ans 2:请建议ans 1:您的CF公式不正确。Find_Text是第一个参数;在_文本中,是第二次尝试:

=ISNUMBER(SEARCH("-",H2))
或者更简单一点

=H2 = "-"
Ans 2:您可以使用事件触发宏。要输入此事件触发宏,请在“工作表”选项卡上单击鼠标右键。 从右键单击下拉菜单中选择“查看代码”。 然后将下面的代码粘贴到打开的窗口中

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rMR As Range, rVP As Range
    Dim C As Range
With Cells
    Set rMR = .Find(what:="MR", after:=[a1], LookIn:=xlValues, lookat:=xlWhole, _
                searchorder:=xlByRows, searchdirection:=xlNext, MatchCase:=False)
    Set rVP = .Find(what:="VP")
End With
    If Not rMR Is Nothing And Not rVP Is Nothing Then
        Set rMR = Range(rMR, Cells(Rows.Count, rMR.Column).End(xlUp))
        Set rVP = rVP.Resize(rowsize:=rMR.Rows.Count)

Application.EnableEvents = False If Not Intersect(Target, rMR) Is Nothing Then For Each C In Intersect(Target, rMR) If C.Value = "+" Then rVP(C.Row).Value = "-" Next C End If If Not Intersect(Target, rVP) Is Nothing Then For Each C In Intersect(Target, rVP) If rMR(C.Row).Value = "+" Then C.Value = "-" Next C End If End If Application.EnableEvents = True End Sub