+ Reply to Thread
Results 1 to 10 of 10

Change Borders Color.

  1. #1
    Registered User
    Join Date
    12-07-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Change Borders Color.

    Hello-

    How can I update the color of existing borders while maintaining the border formats (i.e. thickness and style).
    I am attaching a sample file for testing. Thanks in advance for your help.

    P.
    Attached Files Attached Files
    Last edited by XL_Newbie; 02-26-2012 at 01:25 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Change Borders Color.

    Hilight the area you want, right click/format cells/borders...pick the color you want and apply it to the lines you want. This will not change the line thickness etc
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    12-07-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Change Borders Color.

    Quote Originally Posted by FDibbins View Post
    Hilight the area you want, right click/format cells/borders...pick the color you want and apply it to the lines you want. This will not change the line thickness etc
    Thanks FDibbins. But I am talking about thousands of cells with customized borders. I am looking for a way to automate this.
    Do you know how? Thanks.

    P.

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Change Borders Color.

    there may be an easier solution, but you could use a macro like this

    just need to set the colour, the bellow will make all borders red

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-07-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Change Borders Color.

    [QUOTE=DGagnon;2717909]there may be an easier solution, but you could use a macro like this

    just need to set the colour, the bellow will make all borders red

    That's exactly what I need. Thanks much DGagnon. You got a star.

    P.

  6. #6
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Change Borders Color.

    no problem, if you need help finding a colour value please let me know. Also you may need to adjust the ranges in the loop to suit your specific needs.

  7. #7
    Registered User
    Join Date
    12-07-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Change Borders Color.

    Quote Originally Posted by DGagnon View Post
    no problem, if you need help finding a colour value please let me know. Also you may need to adjust the ranges in the loop to suit your specific needs.
    Actually, yes I need your help with finding value for each color. what method do you use? Thanks.

    P.

  8. #8
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Change Borders Color.

    easiest way to find it would be to record a macro and manualy change one cell to the desired colour. you could then look at the recorded macro in the VB editor and look for the colour attribute. you could also use colorindex instead of color which is a set list of 56 useable colours, that would make the code look like this
    Please Login or Register  to view this content.
    list of colour index can be found at http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  9. #9
    Registered User
    Join Date
    12-07-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Change Borders Color.

    Thanks again for your help. I did try the macro recording first but I kept getting a value of one for the very light grey color selected then plugged in the value into the first code you sent but it didn't work.
    anyway, the later code and color link you sent works fine for me. Thanks again.

    P.

  10. #10
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Change Borders Color.

    any time, glad to help.

+ 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