+ Reply to Thread
Results 1 to 18 of 18

Change Cell border Style with a Macro

  1. #1
    Registered User
    Join Date
    11-09-2006
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    200

    Change Cell border Style with a Macro

    Hello!
    Need your help friends!
    I wonder if you can help me create macro which will automatically change the colour and the width of all of the cell borders which have the content on a worksheet?
    I found this example but it has to be shown all cells with formatting:
    https://stackoverflow.com/questions/...ell-in-a-range
    Thank you!
    Dave

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    Hello zealot,

    I think it would be better if we can see what your Workbook set up with ranges look like.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need.

    Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Change Cell border Style with a Macro

    .
    See if this is what you are seeking ...

    Paste this into a Routine Module:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-09-2006
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    200

    Re: Change Cell border Style with a Macro

    superb! - thank you so much for this beautiful macro Logit!
    Do you think there can be a way to only change the upper and lower borders of the cells with the content?

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    Hello zealot,

    Playing with Logit's initial Code, please try the Code below in the attached Sample Sheet.

    Please Login or Register  to view this content.
    Regards.
    Attached Files Attached Files

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Change Cell border Style with a Macro

    .
    Thanks Winon !

  7. #7
    Registered User
    Join Date
    11-09-2006
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    200

    Re: Change Cell border Style with a Macro

    Superb! works just as needed!
    I have a small question if I can specify the color instead of the red by using a HEX number?
    Thanking for your fabulous help!

  8. #8
    Registered User
    Join Date
    11-09-2006
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    200

    Re: Change Cell border Style with a Macro

    I know you can make VBA wonders here - can you please help me with one more beauty:

    Can you help me create a VBA script which will delete all upper and lower borders from all cells which I have selected (left and right borders will stay the same)?

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    @Logit,

    You are not welcome. Why should I always clean up your mess?

    It is so nice jerking you chain my friend, you are most welcome.

    Kind regards.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Change Cell border Style with a Macro

    .
    They are not messes.

    They are referred to as "Winon Opportunities"

    If no one left you something easy to do, you would have no posts at all.

    Cheers.

    ps: Why have you not responded to post #8 ? He is waiting.

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    Hi zealot,

    Thank you for the feedback, you owe me a Coke and a Bun!

    ...specify the color instead of the red, and...VBA script which will delete all upper and lower borders from all cells which I have selected (left and right borders will stay the same)?
    Here is the Code;

    Please Login or Register  to view this content.
    Please try the attached sample Workbook.

    Hope it helps,

    Kind Regrads
    Attached Files Attached Files

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    @Logit,

    Your blatant cheek and arrogance, just earned you some Rep Points!

    Thanks for your good humor!

    Now leave me be.

  13. #13
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    @Logit,

    ps: Why have you not responded to post #8 ? He is waiting.
    Please study Post# 11, and at least try to learn something from it, if you can.

    cheers.

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Change Cell border Style with a Macro

    .
    Yup !

    I learned you can used Emoticons.

    Congrats.

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    You amaze me with that remaining fragment of a brain cell you apparently still happen to have!

  16. #16
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    Hey Logit,

    Jokes aside. You should stay in contact a bit more. A little bit more. More. A lot more.

    Nice having you as a friend!

  17. #17
    Registered User
    Join Date
    11-09-2006
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    200

    Re: Change Cell border Style with a Macro

    Quote Originally Posted by winon View Post
    hi zealot,

    thank you for the feedback, you owe me a coke and a bun!



    here is the code;

    Please Login or Register  to view this content.
    please try the attached sample workbook.

    hope it helps,

    kind regrads

    fantastic - works exactly as needed!!!! I owe you 35 cokes for this!

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Change Cell border Style with a Macro

    You are welcome zealot, glad we could help!

    O.K., don't bother with the cokes, just click on the star icon in the lower left part of the contributor's post and add Reputation.

    Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

    Please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Thanks.

+ 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. Macro to automatically change chart line style based on cell text
    By NUMagpie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2013, 04:30 PM
  2. Macro to change cell border colors from one color to another
    By Hanskubansku in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2012, 07:41 AM
  3. excel 2007 frame border style
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2009, 03:48 AM
  4. Change cell border & outline in a macro
    By namz in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-07-2008, 03:59 AM
  5. Replies: 2
    Last Post: 07-04-2006, 02:10 PM
  6. Change default border style?
    By kyot58 in forum Excel General
    Replies: 0
    Last Post: 02-27-2006, 02:10 PM
  7. [SOLVED] Checking for the border style of a range
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-09-2006, 05:25 AM
  8. [SOLVED] Changing the border of one cell s/n change the border of adjacent
    By gjanssenmn in forum Excel General
    Replies: 2
    Last Post: 10-05-2005, 04:05 PM

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