AW: Bienenwabe mit Farben auslesen
16.01.2009 09:24:00
RS
Hi Pepi,
Kopier den Code in ein Modul.
Rufe in einer Zelle das Makro Test auf.
Option Explicit
Function ColorFromPallet(Optional lOldCol As Double = xlNone) As Double
Dim dSavCol As Double, dNewCol As Double
Dim iRGB_R As Integer, iRGB_G As Integer, iRGB_B As Integer
dSavCol = ActiveWorkbook.Colors(32)
If lOldCol = xlNone Then
ColIx2RGB 13160660, iRGB_R, iRGB_G, iRGB_B
Else
ColIx2RGB lOldCol, iRGB_R, iRGB_G, iRGB_B
End If
If Application.Dialogs(xlDialogEditColor).Show _
(32, iRGB_R, iRGB_G, iRGB_B) Then
ColorFromPallet = ActiveWorkbook.Colors(32)
ActiveWorkbook.Colors(32) = dSavCol
Else
ColorFromPallet = lOldCol
End If
End Function
Sub ColIx2RGB(ByVal lCol As Long, _
iR As Integer, iG As Integer, iB As Integer)
iR = lCol Mod 256: lCol = lCol \ 256
iG = lCol Mod 256: lCol = lCol \ 256
iB = lCol Mod 256
End Sub
Sub TEST()
Dim x As Variant
ActiveCell.Interior.Color = ColorFromPallet(ActiveCell.Interior.Color)
End Sub
Grüsse RS