【发布时间】:2017-02-10 21:12:22
【问题描述】:
我是 VBA 的初学者,我试图仅突出显示 N 和 AA 列中的空单元格。可以在一个 For 循环中使用多个范围来代替下面的代码吗?
Private Sub CommandButton22_Click()
'HIGHLIGHT
Dim cell As Range
For Each cell In Range("N")
If cell.Value = vbNullString Then
cell.Interior.ColorIndex = 6
End If
Next cell
For Each cell In Range("AA")
If cell.Value = vbNullString Then
cell.Interior.ColorIndex = 6
End If
Next cell
End Sub
【问题讨论】: