Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Using the SpecialCells method

Sub SkipBlanks()     Dim ConstantCells As Range     Dim FormulaCells As Range     Dim cell As Range     On Error Resume Next     Set ConstantCells = Selection.SpecialCells(xlConstants)     For Each cell In ConstantCells         If cell.Value > 0 Then             cell.Interior.Color = vbRed         End If     Next cell End Sub