T
Tom
I have been using the Newsgroup regularly for the past
few months.
In many replies to the questions to the forums, I have
come across a recommendation to use the following site
when the subject is i.e. sorting by background color.
http://www.cpearson.com/excel/colors.htm
I am now attempting to implement some of C. Pearson's
functions, but some of the basic functions don't seem to
work for me (I'm sure that I am doing something wrong).
For instance, I am attempting to display to color index
of a cell by calling the function via (see actual
function between the ******'s below:
=CELLCOLORINDEX(A1,FALSE)
Here's what I do:
- Copy/paste the function into VBA code
- I did NOT add the "Option Explicit" before "Function"
(although I have tried that too and it didn't make a
difference)
- Save code/XLS file
- In the worksheet, change background color of cell A1
to "yellow"
- Copy/paste "=CELLCOLORINDEX(A1,FALSE)" into cell A2
Problem:
I would expect to have cell A2 return the color index of
the value for A1. However, it shows that it can't find
the fuction by displaying the following:
" #Name? ".
In addition, a get a Trace Error (green triangle) -- BTW,
I'm using Excel XP --
What am I doing wrong? Any help is appreciated!
Tom
******************************************
Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the
Interior
' (background) of a cell, or, if OfText is true, of the
Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If
End Function
******************************************
few months.
In many replies to the questions to the forums, I have
come across a recommendation to use the following site
when the subject is i.e. sorting by background color.
http://www.cpearson.com/excel/colors.htm
I am now attempting to implement some of C. Pearson's
functions, but some of the basic functions don't seem to
work for me (I'm sure that I am doing something wrong).
For instance, I am attempting to display to color index
of a cell by calling the function via (see actual
function between the ******'s below:
=CELLCOLORINDEX(A1,FALSE)
Here's what I do:
- Copy/paste the function into VBA code
- I did NOT add the "Option Explicit" before "Function"
(although I have tried that too and it didn't make a
difference)
- Save code/XLS file
- In the worksheet, change background color of cell A1
to "yellow"
- Copy/paste "=CELLCOLORINDEX(A1,FALSE)" into cell A2
Problem:
I would expect to have cell A2 return the color index of
the value for A1. However, it shows that it can't find
the fuction by displaying the following:
" #Name? ".
In addition, a get a Trace Error (green triangle) -- BTW,
I'm using Excel XP --
What am I doing wrong? Any help is appreciated!
Tom
******************************************
Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the
Interior
' (background) of a cell, or, if OfText is true, of the
Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If
End Function
******************************************