'Title: Show the colorindex
'Description: Show the colorindex of the text in the active cell and write the number into it - if no text then it takes the background color

Sub OpGetColor()
' write the colorindex of the active cell backgroundcolor/Textcolor into the cell
    If ActiveCell.Interior.ColorIndex = xlColorIndexNone Then ' active cell has a blank background

        If MsgBox("Do you like to write the actual colorindex (" & ActiveCell.Font.ColorIndex & ") in the cell " & Replace(ActiveCell.Address, "$", "") & "?", vbYesNo) = vbYes Then
            ActiveCell.Value = ActiveCell.Font.ColorIndex
        End If
    Else
        If MsgBox("Do you like to write the actual colorindex (" & ActiveCell.Interior.ColorIndex & ") in the cell " & Replace(ActiveCell.Address, "$", "") & "?", vbYesNo) = vbYes Then
            ActiveCell.Value = ActiveCell.Interior.ColorIndex
        End If
    End If
    
End Sub