+ Reply to Thread
Results 1 to 14 of 14

Creating Dynamic Range Borders

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Creating Dynamic Range Borders

    I am looking to create a border based on a dynamic range. A list is generated from a data validation in cell E2 of a worksheet. The information begins populating in cell "A4":"E4" and down based open the item chosen in the data validation. I would like the information when it is populated to be bordered. I have found a couple macros but can not seem to get any of them to work properly. So far this is the one I have been working with.


    Please Login or Register  to view this content.
    It works creates borders but not in the desired spots. From cell A4:E4 and below based upon the entered information. I think this might be because it does not update with the data validation.


    Moderator Edit:
    @ jaredmccullough

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.
    Last edited by Cutter; 09-07-2012 at 08:13 PM. Reason: Added code tags

  2. #2
    Forum Contributor
    Join Date
    08-09-2012
    Location
    Anch, Alaska
    MS-Off Ver
    2003, 2010, 2013
    Posts
    131

    Re: Creating Dynamic Range Borders

    The macro works at creating borders well, so to help me understand a little more at your final border look.

    Can you give a little more specific info on the borders
    • Is this outline border only?
    • No internal vertical lines per row?
    • Outline and internal Horz lines only?

    Maybe you can upload a sample workbook with Border examples of what you looking for.
    Show different ranges with maybe 1, 6, 10 row(s) variations that have your final look of what you want.
    Give Credit When Credit Is Due - Click On the Star
    Be Sure To Mark Your Post [Solved] When You Get Your Answer

  3. #3
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Creating Dynamic Range Borders

    Bucko Thanks for the reply.....I will just attach my workbook and explain.

    Go to Sheet 3 "Manager Report". Choose an item from the data validation from E2. See how it populates from cell A4 to E4 and down. I want it to work dynamically based on the range of information returned. Essentially I want it to create a border around the cells that are being returned (Border each cell)
    MOC Tracking Database.xlsm

  4. #4
    Forum Contributor
    Join Date
    08-09-2012
    Location
    Anch, Alaska
    MS-Off Ver
    2003, 2010, 2013
    Posts
    131

    Re: Creating Dynamic Range Borders

    jaredmccullough,

    Give this a go, let me know if this is what your looking for.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Creating Dynamic Range Borders

    Bucko,

    It works wonderfully but if you look at the example I provided the first three rows (Heading/Title Rows) are bordered in white and are constant. In the given revision these are not there. I was going to fix it but I didnt know for sure where in the coding is the appropriate spot to put it.

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Creating Dynamic Range Borders

    hi jaredmccullough, please check attachment. Try to change E2 value through dropdown on Manager Report. If data does not appear run code "EnablEvents".
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Creating Dynamic Range Borders

    watersev,

    It seems to work like my desired effect but two issues:

    First what exactly is the purpose of enableevents macro?

    Second if you look at the one provided it returned cells(i, "B") to cells(x, "C") essentially returned dates to manager report sheet for some odd reason that changed in the one you provided but the coding was not changed?

  8. #8
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Creating Dynamic Range Borders

    1. As your code triggering is based on event it may happen that events will not be traced by the application so nothing would happen until you turn them on.
    2. The Worksheet_change code for Manager Report has two changes:

    Yours:
    Please Login or Register  to view this content.
    changed to:
    Please Login or Register  to view this content.
    Another two lines have been added (commented):
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Creating Dynamic Range Borders

    It seems that there is something in the coding that changes the returned data in Column C of the Manager Report Sheet. Originally it returned the dates from column B of other sheets but it is returning Column A of other sheets

  10. #10
    Forum Contributor
    Join Date
    08-09-2012
    Location
    Anch, Alaska
    MS-Off Ver
    2003, 2010, 2013
    Posts
    131

    Re: Creating Dynamic Range Borders

    Copy and Replace the Following Code for Add_Dynamic_Border
    It was an over sight on my part, the code below will fix it.

    Please Login or Register  to view this content.
    Last edited by BuckoAk; 09-11-2012 at 12:46 PM. Reason: added additional code to reply

  11. #11
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Creating Dynamic Range Borders

    This works appropriately Bucko much appreciated. Is there anyway to get the borders for the first three rows to be white as in the originally provided example without to much extra work? If not this should suffice.

  12. #12
    Forum Contributor
    Join Date
    08-09-2012
    Location
    Anch, Alaska
    MS-Off Ver
    2003, 2010, 2013
    Posts
    131

    Re: Creating Dynamic Range Borders

    Sorry about that jaredmccullough, I knew I should have downloaded a new file.
    See my last post, I add additional code to the bottom.
    Just copy and past in the new section and you should be good to go.

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Creating Dynamic Range Borders

    Why dont you just use Conditional Formatting?
    I suspect it is because you have merged cells in Rows 1:2, and you couldn't get C/F to work.

    Get rid of them!

    See this workbook
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  14. #14
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Creating Dynamic Range Borders

    Thank you for all your help Bucko and everyone who gave their input

+ 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