+ Reply to Thread
Results 1 to 2 of 2

re-apply different colour to cell borders

  1. #1
    Registered User
    Join Date
    07-25-2006
    Posts
    11

    re-apply different colour to cell borders

    All of my cells including merged have borders colour of black, default. Is there a Vb routine I can write to detect existing colour and repaint it with a new colour.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    03-15-2005
    Location
    North Carolina
    MS-Off Ver
    2003 & 2007
    Posts
    180
    This routine will check the top border of the active cell to see if it has a color and then will change it to your liking.

    Sub ChangeBorder()
    Dim cell As Range
    Dim myColor as Integer

    Set cell = ActiveCell
    myColor = 3 'Red

    If cell.Borders(xlEdgeTop).ColorIndex >= 1 Then
    cell.Borders(xlEdgeTop).ColorIndex = myColor
    cell.Borders(xlEdgeBottom).ColorIndex = myColor
    cell.Borders(xlEdgeLeft).ColorIndex = myColor
    cell.Borders(xlEdgeRight).ColorIndex = myColor
    End If

    End Sub

    HTH

    Jason

+ Reply to 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