Sub PokazWartosciRGB()
Dim intNumColor As Integer
Dim strHexVal, strRGBVal As String

   'Tworzenie naglowkow
   Range("A1").Select
   ActiveCell.Formula = "Kolor"
   ActiveCell.Offset(0, 1).Formula = "Numer w indeksie"
   ActiveCell.Offset(0, 3).Formula = "Red"
   ActiveCell.Offset(0, 4).Formula = "Green"
   ActiveCell.Offset(0, 5).Formula = "Blue"

   ActiveCell.Offset(1, 0).Activate

For intNumColor = 1 To 56

   ActiveCell.Interior.ColorIndex = intNumColor
   rgbVal = ActiveCell.Interior.Color
   ActiveCell.Offset(0, 1).Formula = Str(ActiveCell.Interior.ColorIndex)
   ActiveCell.Offset(0, 3).Value = rgbVal And &HFF
   ActiveCell.Offset(0, 4).Value = rgbVal \ &H100 And &HFF
   ActiveCell.Offset(0, 5).Value = rgbVal \ &H10000 And &HFF

   ActiveCell.Offset(1, 0).Activate

   Next intNumColor
End Sub
