提问人:JEEPJENN 提问时间:10/27/2023 更新时间:10/27/2023 访问量:8
我目前有一些VBA代码,可以根据单元格的内容运行和突出显示单元格。如果单元格为空,如何添加VBA以检查R列?
I currently have some VBA code that runs and highlights cells based on their contents. How do I add VBA to check column R if the cells are blank?
问:
这就是我目前所拥有的,而且效果很好!我不确定如何在 R 列中为空白单元格添加其他选项。
Sub Highlight_Specials()
'
' Highlight_Specials Macro
'
'
Columns("F:F").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""RAND"""
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Columns("P:P").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""YES"""
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
ActiveWindow.SmallScroll Down:=-9
End Sub
我当然不是专家,但我能够编辑上面的 VBA 以在我的电子表格中找到特定单词并突出显示它们。“RAND”和“Yes”被正确突出显示......如何指定仍在数据正文中的空白单元格?(我不希望它突出显示电子表格上的所有其他单元格!
任何关于阅读内容的帮助或建议,将不胜感激!
答: 暂无答案
评论