Results 1 to 6 of 6

[Probably SOLVED] Bottom border depending on matching cell value

Threaded View

  1. #1
    Registered User
    Join Date
    07-11-2009
    Location
    London
    MS-Off Ver
    Excel 2000
    Posts
    12

    [Probably SOLVED] Bottom border depending on matching cell value

    I want to add borders to a range depending on the value in the "a" column.

    Normally I want a left border in cell "a", a right border in cell "h" and bottom border in cells "a" to "h".

    However if the value in cell "a" is the same as the cell below I do not want the bottom border.

    Cell "a" contains the names of customers using our facilities each day. Some customers use several facilities on the same day. I want the borders to encompass all facilities used by each customer per day e.g. range "a1:h8" might need bottom borders on all rows, because they are single customers using only one facility that day but ranges "a9:h11" would require bottom borders only on row 11, because that customer is using three of our facilities that day.

    I found this thread:-

    http://www.excelforum.com/excel-prog...condition.html

    and amended part of it to read:-

    Set Rng = ActiveSheet.Range("a:h").SpecialCells(xlCellTypeConstants)

    change the Range to "a:h"

    and:-

    With .Borders(xlEdgeLeft)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeRight)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With .Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With

    set the three borders.

    But when I run it I get a left border only in cells in the "g" column only if the cell contains a value and a bottom border if the cell is the last to have a value.

    I take I don't need the code:-

    If Not Rng Is Nothing Then
    For Each aRng In Rng.Areas
    CreateBorder aRng
    Next
    End If

    but something else to pick up my whole range but modified for matching values?

    Can anyone please advise?
    Last edited by athegn; 07-27-2009 at 09:36 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1