使用数值突出显示单元格

我只是想用数字来突出显示单元格。 这个macros也用文本突出显示单元格。

Sub high() Dim ws As Worksheet Dim yourrange As Range Set ws = ActiveSheet For Each yourrange In ws.Cells.SpecialCells(xlCellTypeConstants) yourrange.Interior.Color = 65535 Next yourrange End Sub 

有两种select:使用VBA和不使用WBA:

1)使用VBA

没有使用循环,感谢@Siddharth Rout 🙂

 Sub high() Dim ws As Worksheet Dim rng As Range Set ws = ActiveSheet On Error Resume Next Set rng = ws.Cells.SpecialCells(xlCellTypeConstants, xlNumbers) On Error GoTo 0 If Not rng Is Nothing Then rng.Interior.Color = 65535 End Sub 

使用循环:

 Sub high() Dim ws As Worksheet Dim yourrange As Range Dim rng As Range Set ws = ActiveSheet On Error Resume Next Set rng = ws.Cells.SpecialCells(xlCellTypeConstants) On Error GoTo 0 If Not rng Is Nothing Then For Each yourrange In rng If IsNumeric(yourrange) Then yourrange.Interior.Color = 65535 Next yourrange End If End Sub 

2)没有VBA,(感谢@pnuts):

转到function区上的“ 查找并select ”菜单项并select“ GoTo Special .. ”:

在这里输入图像描述

select“ 常量 ”, select“ 数字 ”,然后按“确定”。

在这里输入图像描述

现在,excel突出显示所有数字单元格:

在这里输入图像描述

下一步是填充他们所需的颜色:

在这里输入图像描述

完成:)