excelvbacolorsfontschronological

Want to create a chronological row # then reset based on font color


I want to create a column that numbers itself chronologically based on the column to its left based on font color. Then when a new font color appears in the column, I would like it to reset and then number the rows again. Pretty much create a line item column.

I found a code that kind of worked but it wasn't what I needed.

enter image description here

I tried other codes but nothing I found worked.


Solution

  • You could use this function to test the font color:

    Option Explicit
    Function TextColour(RG As Range)
        Application.Volatile
        TextColour = RG.Font.Color
    End Function
    

    Then use it like this:

    EUsage

    Example:

    enter image description here