Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Dave. I didn't test my macro with only constants
or only formulas in the col. A. -----Original Message----- I like your idea, but you'll get an error in only constants or only formulas are in that range. maybe... Option Explicit Sub Test() Dim rngCol As Range Dim rngC As Range Dim rngF As Range Dim rngCF As Range Set rngCol = Columns("A:A") On Error Resume Next Set rngC = rngCol.SpecialCells(xlCellTypeConstants) Set rngF = rngCol.SpecialCells(xlCellTypeFormulas) On Error GoTo 0 If rngC Is Nothing Then Set rngCF = rngF ElseIf rngF Is Nothing Then Set rngCF = rngC Else Set rngCF = Union(rngC, rngF) End If If rngCF Is Nothing Then MsgBox "no formulas or constants in that range!" Else rngCF.Select End If Exit Sub Jason Morin wrote: With error-trapping: Sub Test() Dim rngCol As Range Dim rngC As Range Dim rngF As Range Dim rngCF As Range Set rngCol = Columns("A:A") On Error GoTo ErrorFound Set rngC = rngCol.SpecialCells(xlCellTypeConstants) Set rngF = rngCol.SpecialCells(xlCellTypeFormulas) Set rngCF = Union(rngC, rngF) rngCF.Select Exit Sub ErrorFound: MsgBox "No cells found." End Sub --- HTH Jason Atlanta, GA -----Original Message----- Sub Test() Dim rngCol As Range Dim rngC As Range Dim rngF As Range Dim rngCF As Range Set rngCol = Columns("A:A") Set rngC = rngCol.SpecialCells(xlCellTypeConstants) Set rngF = rngCol.SpecialCells(xlCellTypeFormulas) Set rngCF = Union(rngC, rngF) rngCF.Select End Sub --- HTH Jason Atlanta, GA -----Original Message----- how do I programmically highlight only those cells in a column that contain data? . . -- Dave Peterson . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Highlight cells where the last charcter in the cell is a blank | Excel Worksheet Functions | |||
highlight highest and lowest cells within a given column in ex | New Users to Excel | |||
highlight highest and lowest cells within a given column in excel | New Users to Excel | |||
Highlight selected cells if text is in certain column | Excel Programming | |||
Highlight blank cells | Excel Programming |