Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to sort rows by color. I have created a column for ColorIndex and
then created the following VBA code. Function ColorIndexOfCell(Rng As Range, Optional OfText As Boolean, Optional DefaultAsIndex As Boolean = True) As Integar Dim C As Long If OfText = True Then C = Range("c1:c10").Font.ColorIndex Else C = Range("c1:c10").Interior.ColorIndex End If If (C < 0) And (DefaultAsIndex = True) Then If OfText = True Then C = GetBlack(Range("c1:c10").Worksheet.Parent) Else C = GetWhite(Range("c1:c10").Worksheet.Parent) End If End If ColorIndexOfCell = C End Function When I put the following formula into a cell of the Colorindex column =COLORINDEXOFCELL(A1,TRUE,TRUE) I get a compile error message "User-defined type not defined". Hopefully it's a simple error, I am fairly new to VBA programming. -- Marshall |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting CF Color | Excel Worksheet Functions | |||
Sorting by color | Excel Discussion (Misc queries) | |||
Sorting by color | Excel Discussion (Misc queries) | |||
Sorting by color | Excel Discussion (Misc queries) | |||
Sorting by color? | Excel Worksheet Functions |