Closed Thread
Results 1 to 6 of 6

[Probably SOLVED] Bottom border depending on matching cell value

  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.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Bottom border depending on matching cell value

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: Bottom border depending on matching cell value

    Post reformatted with code tags:-

    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:-


    Please Login or Register  to view this content.
    change the Range to "a:h"

    and:-

    Please Login or Register  to view this content.
    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:-

    Please Login or Register  to view this content.
    but something else to pick up my whole range but modified for matching values?

    Can anyone please advise?

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

    Re: Bottom border depending on matching cell value

    It would seem my link to another post is wrong.

    This works:-

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

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

    Re: [probably SOLVED] Bottom border depending on matching cell value

    I have resolved this by using Conditional formatting, see:-

    http://www.excelforum.com/excel-gene...ml#post2134753

    However I may have to return if I can't resolve my follow up question:-

    http://www.excelforum.com/excel-gene...el-2000-a.html

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: [Probably SOLVED] Bottom border depending on matching cell value

    A thread should be marked Solved or left alone, not Probably Solved
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

Closed Thread

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