2 BG Colors in One cell

  • The following code works.

    1. Private Sub cmdMultipleFontColorInSingleCell_Click()
    2. 'https://www.ozgrid.com/forum/forum/help-forums/excel-general/43942-multiple-font-color-in-single-cell
    3. Sheets("Sheet3").Select
    4. Range("a6").Select
    5. ActiveCell.Characters(Start:=1, Length:=6).Font.ColorIndex = 3
    6. ActiveCell.Characters(Start:=8, Length:=5).Font.ColorIndex = 5
    7. End Sub

    The following code works.

    1. TxtClr = 16711680 (RGB COLOR)
    2. BgClr = 16775408
    3. Worksheets(ShNam).Cells(RowNum, ColNum).Font.Color = TxtClr
    4. Worksheets(ShNam).Cells(RowNum, ColNum).Interior.Color = BgClr

    The following code is not workng.

    1. Endr = 5
    2. Worksheets(ShNam).Cells(RowNum, ColNum).Characters(Start:=1, Length:=Endr).Font.Color = TxtClr
    3. Worksheets(ShNam).Cells(RowNum, ColNum).Characters(Start:=1, Length:=Endr).Interior.Color = BgClr

    Is it possible to have 2 BG colors in one cell?

  • I am preparing a report to present it colorfully. It will be something like this. The first word in the Description cell will be the same for a few rows. Then the following rows will begin with another word and this second word will be the beginning word for the following few rows and it goes on like this. Now I can give different font colors as shown above. I would like to give background color also. One BG Color for the first word and another BG Color for the rest of words in that cell. Likewise in the following rows. In this way, Bernard will be on Yellow Background and Breakfast, Dinner & Lunch of him will be in blue background. Similarly, David will have green color background and his expenses will be on pink colour background.

    Is this possible?

    If not, should I be satisfied with the FONT Colors?

    Kindly reply.

  • Hello again,

    With the description you are giving, my recommendation would be to stick only to the Font colors ...

    If you feel like digging into the topic further ... have a look at Fill Effects > Gradient > Two colors ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Like" icon ...just below...in the bottom right corner...:)