+ Reply to Thread
Results 1 to 13 of 13

Apply Border to Main Area - Hiccup

  1. #1
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Apply Border to Main Area - Hiccup

    This code is working great, as needed, except on one of my workbook sheets. I cannot figure out what the difference in the two sheets is which is causing the code to apply the border incorrectly.

    In the attached file, there are two different layouts: Main Page(?) and Adjustments(?)
    The code works great on Main Page, but is bordering the wrong area on Adjustments. It uses the row/columns where two text strings are found as markers for the Range'ing part of the code since other workbooks will not have the same exact layout but will have those same labels.

    Please Login or Register  to view this content.
    I've toggled back 'n forth many times between the two layouts and can't pickup on the difference which is causing the code to border the wrong area on Adjustments.

    I've input some zeroes (highlighted) into a few of the far-right column cells so you can watch the code work.
    On Main Page, you will see the border applied to the correct COMPARABLES area. On Adjustments, the border ends up bounding the first row and the row with "COMPARABLES" in the first column cell.
    Main Page is correct.

    What am I not seeing?

    Thank you,
    Delain

  2. #2
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,122

    Re: Apply Border to Main Area - Hiccup

    Your cursor has to be on the active sheet before you run the code.

    It could also this line
    INDICATED VALUE
    is a partial match, so any word which looks like this word might be the first one to be found.
    Please attach the sample book with the code and will correct it.
    Last edited by AB33; 07-07-2016 at 02:24 PM.

  3. #3
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Apply Border to Main Area - Hiccup

    Huh, my attachment attempt didn't attach; didn't notice till you mentioned. On the preview it was there.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,122

    Re: Apply Border to Main Area - Hiccup

    Yes, you are right. There seems to be a bug on my code. I need to look at it. Right now, I am in a middle of a footie.

    Try this one and let me know.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Apply Border to Main Area - Hiccup

    Holy cow! A couple of misplaced periods(.)???!!! That's the difference in the code??
    How was it even able to run with such a slight difference? I've got so much to learn on the Range'ing code. I just don't get it.
    Seems to have fixed the problem.

    (I messed up with the attachment and description of the post. I presumed the row deleting part of my larger code that you helped me with, yet didn't include it for others who might have stumbled into this post. Didn't need it since that Sub Calls the Border_Apply Sub.)

    Footie?

    Thank you,
    Delain

  6. #6
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,122

    Re: Apply Border to Main Area - Hiccup

    Delain,
    I need to look at it again. Please let me know if the code fails again.
    It is the European semi-final and the referee just given a penalty to France ( You call it soccer).

  7. #7
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Apply Border to Main Area - Hiccup

    Good, cause I'd like to understand the difference, when you have time.

    Also, seems something needs to be changed in the other code posting from #7 in:http://www.excelforum.com/showthread...t=#post4426709

    It's not working with the Adjustments sheet either.

    Later.

    Thank you,
    Delain

  8. #8
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,122

    Re: Apply Border to Main Area - Hiccup

    You already know, the dots are messing up the code, but I need to do lots of test. For now, try

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    881

    Re: Apply Border to Main Area - Hiccup

    I don't think it is the periods/fullstops messing it up (they should be in front of the "Cells" to refer to whatever is in the with statement, it doesn't make any difference here as you are referring to the activesheet but does when you start referring to actual sheets).

    I think it is the last part of the range causing the issue.
    Can you just try the below (if I have it right on what you are trying to border)...


    Please Login or Register  to view this content.
    Last edited by WasWodge; 07-07-2016 at 07:26 PM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  10. #10
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,122

    Re: Apply Border to Main Area - Hiccup

    Delain,

    Okay, Try this one
    Attached Files Attached Files

  11. #11
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Apply Border to Main Area - Hiccup

    WW, not sure I can see the difference with your suggested code from what I had. However, your code is giving the same bad result on the Adjustments sheet but good result on the Main Page sheet.
    See attached wkbk for your result versus what is needed.

    AB33, did you determine what the difference with the two sheets is which your new code addresses?
    The new code works on the Adjustment sheet as needed; along with, the Main Page as the original code was already doing.

    Thanks for the great help.

    Delain
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    881

    Re: Apply Border to Main Area - Hiccup

    So what do you get with the below (I haven't looked at the latest sheet by AB33 so apologies in advance if it is the same)?

    Please Login or Register  to view this content.
    Last edited by WasWodge; 07-08-2016 at 02:12 PM.

  13. #13
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Apply Border to Main Area - Hiccup

    Now, we can call it a beautiful thing! From what I can tell, as far as coding, it is exactly the same as AB33's and gives the same and needed result.

    I would still appreciate some insight as to why the original would work fine on the one sheet but not on both. Their layouts are very similar.

    Thank you,
    Delain

+ 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] Apply Border to Main Area
    By delaing in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-05-2016, 06:15 PM
  2. Border Around Print Area
    By kmlloyd in forum Excel General
    Replies: 0
    Last Post: 04-19-2011, 11:41 AM
  3. Apply Border based on change in cell value?
    By efeb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-11-2009, 04:41 PM
  4. Print border around printed area
    By pnocero in forum Excel General
    Replies: 0
    Last Post: 01-14-2008, 12:39 AM
  5. [SOLVED] Apply Border to range when first cell has text.
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2005, 04:05 PM
  6. Apply Border
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-28-2005, 08:05 PM
  7. Apply Border based on last Day of Month
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2005, 03: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