+ Reply to Thread
Results 1 to 8 of 8

Apply cell border formatting to all sheets in workbook

  1. #1
    Forum Contributor
    Join Date
    10-03-2015
    Location
    North Carolina, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Apply cell border formatting to all sheets in workbook

    Hi,

    I have a workbook with several sheets. Each sheet has data in column K. K1 is a header. Below that are numbers, but each sheet has a different number of rows. At the end of the numbers is a single blank row. Below the blank row is a total of all of the numbers in column K.

    So, for example, K1 has "Header", K2 contains "1", K3 contains "2", K4 is blank, and K5 contains "3" (sum of K2 and K3). But, on the next sheet, there might be 30 rows of numbers.

    I am looking for help with adding cell borders around the total. In the example above, cell K5.

    I tried the below code, but to no surprise at all, it doesn't work:

    Please Login or Register  to view this content.
    Help, Please!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Apply cell border formatting to all sheets in workbook

    Try...

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    10-03-2015
    Location
    North Carolina, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Re: Apply cell border formatting to all sheets in workbook

    Thank you, Jeffrey,

    Your code works perfectly. The only problem is that the borders are not the ones that I want. That's my fault, obviously.

    I want a thin line at the top of the cell, and double thin lines at the bottom of the cell. No vertical or horizontal lines. If I use the record function and add the borders that I want, here is what Excel produces:

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 05-10-2019 at 11:27 AM. Reason: Removed full quote!

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Apply cell border formatting to all sheets in workbook

    How about...

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-03-2015
    Location
    North Carolina, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Re: Apply cell border formatting to all sheets in workbook

    Thanks again! It worked like magic.

    Now, I realize I should have asked this earlier, but if I wanted to apply that same formatting, following the same logic, to columns L & M, should I just rewrite that same macro two more times substituting the column letters, or is there a better way?
    Last edited by jeffreybrown; 05-10-2019 at 03:33 PM. Reason: Removed full quote!

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Apply cell border formatting to all sheets in workbook

    How about...

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-03-2015
    Location
    North Carolina, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Re: Apply cell border formatting to all sheets in workbook

    Wizardry! Pure wizardry.

    Thank you so much!
    Last edited by jeffreybrown; 05-10-2019 at 04:11 PM. Reason: Removed full quote!

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Apply cell border formatting to all sheets in workbook

    You are very welcome and thanks for the feedback.

+ 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] Want to apply code to all sheets available in workbook except two sheets with fast working
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-28-2017, 08:55 AM
  2. [SOLVED] Apply border automatically based on Conditional Formatting
    By Lola90 in forum Excel General
    Replies: 4
    Last Post: 10-26-2015, 10:25 AM
  3. Replies: 0
    Last Post: 09-28-2015, 04:46 PM
  4. [SOLVED] Add border & apply conditional formatting to sheets based on cell value
    By amar05 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2013, 11:02 AM
  5. 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
  6. Replies: 2
    Last Post: 07-04-2006, 02:10 PM
  7. 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

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