Format Border Based On Cell Content

  • Hi,
    I have a dynamic table (rows regularly added or deleted) that is generated automatically based on choices made by the user in another worksheet. I need a function that will examine all the cells in one column, and when it finds a difference between two cell entries, it will change the border between these two entries to dark (medium weight), and then extend this border across the table. The end result should be that wherever the cell contents differ within a column, the table is divided by a darker border across the entire row.
    Any advice appreciated.


    thanks

  • Re: Border Formatting Based On Cell Content


    Here is a macro that will do this from Cell A1 to the last filled cell in column A. If you need this to run constantly, you can use the Worksheet_Change event to monitor the column.



    Hope this helps,
    Fencliff

  • Re: Border Formatting Based On Cell Content


    Thanks, this works perfectly, but how can I modify EntireRow to a specific Range?

  • Re: Border Formatting Based On Cell Content


    Instead of


    Code
    With .EntireRow.Borders(xlEdgeBottom)


    use


    Code
    With .Resize(1, 10).Borders(xlEdgeBottom)


    Where 10 is the number of columns you want to extend the border to.


    Rgds,
    Fencliff

  • Re: Format Border Based On Cell Content


    Dave, at least in Excel 2003 you can't (oddly enough) apply medium width borders with conditional formatting. It's one of these Excel "features" I've never really understood myself.

  • Re: Format Border Based On Cell Content


    Thanks, the Resize coding works great, but I would like to learn how to apply it to the preceeding columns as well. My qualifying column is "E" and I would like the dark border to extend from column "A" to column "BB" in the following:


  • Re: Format Border Based On Cell Content


    Hi, only changed one line in the code:


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!