Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How would I go about interrogating the format and/or custom format of a
cell, please? I am assuming that this has to be done by VBA hence I have only posted the question in this newsgroup, but if there is a non-VBA solution I would be interested. Examples might be: 1) A function: =FUNC(cell_ref) should return the text string "green" if the background colour of cell_ref is green 2) I might want to sort a range of cells by the background colour of cells in Column B. There are numerous other possibilities, so I am only looking for general pointers (or a URL that may explain it in depth). Thanks. -- Return email address is not as DEEP as it appears |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Try: Function CellColor(Optional Reference As Range) As Long If Reference Is Nothing Then Set Reference = Application.Caller With Reference.Cells(1).Interior If .ColorIndex = xlColorIndexNone Then CellColor = 0 Else CellColor = .ColorIndex End If End With End Function I wouldn't specify volatile.. Changing a cells color does NOT trigger a change event. So before sorting you'll have to force a recalc. keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Jack Schitt" wrote: How would I go about interrogating the format and/or custom format of a cell, please? I am assuming that this has to be done by VBA hence I have only posted the question in this newsgroup, but if there is a non-VBA solution I would be interested. Examples might be: 1) A function: =FUNC(cell_ref) should return the text string "green" if the background colour of cell_ref is green 2) I might want to sort a range of cells by the background colour of cells in Column B. There are numerous other possibilities, so I am only looking for general pointers (or a URL that may explain it in depth). Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for that.
"keepitcool" wrote in message ... Try: Function CellColor(Optional Reference As Range) As Long If Reference Is Nothing Then Set Reference = Application.Caller With Reference.Cells(1).Interior If .ColorIndex = xlColorIndexNone Then CellColor = 0 Else CellColor = .ColorIndex End If End With End Function I wouldn't specify volatile.. Changing a cells color does NOT trigger a change event. So before sorting you'll have to force a recalc. keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Jack Schitt" wrote: How would I go about interrogating the format and/or custom format of a cell, please? I am assuming that this has to be done by VBA hence I have only posted the question in this newsgroup, but if there is a non-VBA solution I would be interested. Examples might be: 1) A function: =FUNC(cell_ref) should return the text string "green" if the background colour of cell_ref is green 2) I might want to sort a range of cells by the background colour of cells in Column B. There are numerous other possibilities, so I am only looking for general pointers (or a URL that may explain it in depth). Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lock Cell Format - Allow copy and paste of data without format change | Excel Worksheet Functions | |||
Need help with converting CUSTOM format/TEXT format to DATE format | Excel Worksheet Functions | |||
Interrogating cells by cell formatting | Excel Worksheet Functions | |||
Interrogating Data in Excel | New Users to Excel | |||
how to format excel format to text format with separator "|" in s. | New Users to Excel |