+ Reply to Thread
Results 1 to 8 of 8

borders around to specific range

  1. #1
    Forum Contributor
    Join Date
    01-06-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    118

    borders around to specific range

    Hi,



    Pls go through the attachment. I want to apply borders (border around & xlmedium) from b2:k21. i wrote a single line of code, there is no errors while running the code but the line of code not applying the borders. pls correct it.



    thank you in advance.



    regards
    shiva
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: borders around to specific range

    The BorderAround method has frustrated me for years. I stopped bothering with it. This is my alternate method:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: borders around to specific range

    Hi,

    Just for information, your code works perfectly for me in that sample workbook in 2010.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: borders around to specific range

    ...and for me in 2010 it fails. That function has frustrated me to tears.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: borders around to specific range

    That is indeed strange; I have never once had an issue with it.

    Purely out of curiosity, and if you have the time and inclination, does this fare any better
    Please Login or Register  to view this content.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: borders around to specific range

    Grr.... I was certain I had tried that first yesterday, same error for me every time.
    https://www.screencast.com/t/XRfI497hOs4h

    But now I see from your snippet I was using ColorIndex instead of Color. Your syntax does work for me. That is the first time I've seen this codeline work for me....well...ever. Thanks!

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: borders around to specific range

    You're welcome. I find it intriguing as I have never had to specify that part unless actually wanting a colour other than the default black.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: borders around to specific range

    You can also use ColorIndex that uses index of Colorpalette or one of two constants xlColorIndexAutomatic(-4105) and xlColorIndexNone(-4142).
    Color is used if you want to specify color in the form of RGB value
    Last edited by bakerman2; 02-22-2017 at 12:53 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] borders around range of cells inside another range
    By scott micklo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2016, 11:09 AM
  2. Not Copying Borders of range
    By noobsesher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2015, 04:11 PM
  3. [SOLVED] Use of Range and Last row to add borders around cells.
    By BBoydAnchor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2012, 01:38 AM
  4. Locked/Freeze borders on specific cells
    By sslack in forum Excel General
    Replies: 4
    Last Post: 04-22-2012, 02:54 PM
  5. borders between 2 specific words
    By pedy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-08-2009, 12:55 PM
  6. Setting specific font and borders with VBA
    By penny in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2008, 04:41 PM
  7. The borders of the selected range
    By dboyko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2007, 04:56 AM

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