+ Reply to Thread
Results 1 to 11 of 11

Need help with Macro for Cell Borders

  1. #1
    Registered User
    Join Date
    04-14-2017
    Location
    Holland, MI
    MS-Off Ver
    2016
    Posts
    5

    Need help with Macro for Cell Borders

    I work for a camp that takes 4,500 kids every summer. I use Excel to keep track of which session each camper is coming and who they want to bunk with. I put borders around the bunkmates to keep them together. Way back when I used an older version of Excel, I created a Macro for putting boxes around pairs of campers. Unfortunately, Excel has changed how some features work and now I'm having trouble. Used to be I could put a box around two cells and a box around two adjacent cells. Then I could move them around with no problem. Now when I move a pair of campers, I lose one of the borders because when there is a border between 2 cells, it acts as a shared border. I need to have it where I can put a border at the bottom of one cell and a border at the top of the cell below it and have each one stay with the cell contents when I move it. I hope that makes sense.

    I've researched many times to see if this was possible and I keep seeing stuff about "inside borders". But I haven't been able to figure out if there is a way to create a Macro that will make the borders behave the way I need them too.

    Any help I can get would be much appreciated!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help with Macro for Cell Borders

    How are you "moving" cells; what method?

    Can you post your old macro?

    Perhaps you could attach a workbook that illustrates the problem?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Need help with Macro for Cell Borders

    Hi judy and welcome to the forum,

    Darn... Borders or colors aren't real "data". I wish you could post a sample of your workbook and let us see what you are doing. It sounds like you are doing a lot of drag and drop, by hand. There might be a better way if we could see your workbook/worksheet layout.

    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.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Need help with Macro for Cell Borders

    I can't recreate your "misfortune"
    Please Login or Register  to view this content.
    If you now select cells B6 and B7 and pull them down, both ranges still will have a border around the two cells.

  5. #5
    Registered User
    Join Date
    04-14-2017
    Location
    Holland, MI
    MS-Off Ver
    2016
    Posts
    5

    Re: Need help with Macro for Cell Borders

    Thanks so much for your responses. I have attached a sample document. I use drag and drop. You can see in the second example in the workbook where I lost a border when I moved the second set of names.

    I also attached (in a Word doc) the macro that I created. It was done in Excel 2007. (I know that where I used Control-B in 2007, I have to use Control-Shift-B in Excel 2016 because they no longer allow you to use just Control-B since that's normally for bolding things.)
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help with Macro for Cell Borders

    I could duplicate your issue.

    Try this borders method. It's seemed to work for me. You'll have to recreate the borders for any that already exist.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 04-15-2017 at 12:08 PM.

  7. #7
    Registered User
    Join Date
    04-14-2017
    Location
    Holland, MI
    MS-Off Ver
    2016
    Posts
    5

    Re: Need help with Macro for Cell Borders

    Thanks! I will give that a try when I get to the office on Monday!

  8. #8
    Registered User
    Join Date
    04-14-2017
    Location
    Holland, MI
    MS-Off Ver
    2016
    Posts
    5

    Re: Need help with Macro for Cell Borders

    Quote Originally Posted by AlphaFrog View Post
    I could duplicate your issue.

    Try this borders method. It's seemed to work for me. You'll have to recreate the borders for any that already exist.

    Please Login or Register  to view this content.
    You are my HERO! That is REALLY, REALLY close to what I need! I didn't think to mention it earlier but I also want it to remove any inside borders that might be there when I use the macro. Would that be possible?

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help with Macro for Cell Borders

    Try this...

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-14-2017
    Location
    Holland, MI
    MS-Off Ver
    2016
    Posts
    5

    Re: Need help with Macro for Cell Borders

    Quote Originally Posted by AlphaFrog View Post
    Try this...

    Please Login or Register  to view this content.
    You have no idea how happy you have made me today! I've been fighting with this for 3 years! This will save me SO much time and eliminate errors. Thank SO much!

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help with Macro for Cell Borders

    You're welcome. Glad it worked out for you.

+ 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 that would draw a line using cell borders after user input
    By Tom T Hall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2014, 11:25 AM
  2. Cell borders not appearing correctly when I run my macro
    By JimmyJazz7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2013, 02:58 PM
  3. Adding Borders Based on a Cell Value - macro
    By cheesiepoof05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 01:42 PM
  4. [SOLVED] Macro - Cell borders + Red Rows
    By delusional in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2012, 06:33 AM
  5. macro that puts in borders on any cell that is not empty
    By mash100 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-18-2012, 03:45 PM
  6. problem with cell borders macro
    By mehdoush in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-05-2009, 03:36 PM
  7. Macro to change cell borders
    By Roddie Grant in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2005, 07:06 AM

Tags for this Thread

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