David McCritchie has a lot of code on his site.
however, i find it a bit confusing to use names.
to me it's simple : i KNOW the position on the ColorFill palet.
so i have a little function mapping palette location to colorindex.
Sub DemoUse()
'Green
ActiveCell(1, 1).Interior.ColorIndex = ColorMap(4, 4)
'Orange
ActiveCell(2, 1).Interior.ColorIndex = ColorMap(2, 2)
End Sub
Function ColorMap&(PaletteRow&, PaletteCol&)
Dim PaletteIndex&
Static aIdx
If IsEmpty(aIdx) Then
aIdx = Array(1, 53, 52, 51, 49, 11, 55, 56, 9, 46, 12, _
10, 14, 5, 47, 16, 3, 45, 43, 50, 42, 41, 13, 48, 7, 44, _
6, 4, 8, 33, 54, 15, 38, 40, 36, 35, 34, 37, 39, 2, 17, _
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, _
32)
If LBound(aIdx) = 0 Then
ReDim Preserve aIdx(1 To UBound(aIdx) + 1)
End If
End If
PaletteIndex = (PaletteRow - 1) * 8 + PaletteCol
If PaletteIndex >= 1 And PaletteIndex <= 56 Then
ColorMap = aIdx(PaletteIndex)
Else
ColorMap = xlNone
End If
End Function
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
RandyDtg1 wrote :