+ Reply to Thread
Results 1 to 7 of 7

Macro to apply borders to all cells with text and numbers

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Macro to apply borders to all cells with text and numbers

    Hi all,

    I know there is a macro that can apply borders to all cells that contains text (http://www.excelforum.com/excel-prog...255&viewfull=1).
    I have one sheet that has a block of rows with a header and at the bottom there is the text "Total" and to the right the sum. All the cells with content are given a border, but the sum (numbers) is not given a border. Is there any way to include a line of code in the above mentioned macro so it will do this as well?

    If that could be done, it would be really great.

    This forum is very informative and a lot of people really helping out and that is really great for persons new to VBA.
    Thanks and keep up to good work ;-)

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro to apply borders to all cells with text and numbers

    I don't understand your problem, the above mentioned macro runs for me, can you attach a sample of your file ?

  3. #3
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Macro to apply borders to all cells with text and numbers

    Hello,

    Thanks for your email.
    I can't attach from work an excel file so I will put it in text below. When I run the macro the amount in column 4 at the bottom is not included in the borders. It is strange for me that this one is left out. Mabye the macro only selects where only text is, but then in column 4 there are also numbers.

    Title title Title Title Title Title Title
    Text Text Text 123 Text Text Text
    Text Text Text 124 Text Text Text
    Text Text Text 125 Text Text Text
    Text Text Text 126 Text Text Text
    Text Text Text 127 Text Text Text
    Text Text Text 128 Text Text Text
    Text Text Text 129 Text Text Text
    Text Text Text 130 Text Text Text
    Text Text Text 131 Text Text Text
    Text Text Text 132 Text Text Text
    Text Text Text 133 Text Text Text
    Text Text Text 134 Text Text Text
    Text Text Text 135 Text Text Text
    Text Text Text 136 Text Text Text
    Text Text Text 137 Text Text Text
    Text Text Text 138 Text Text Text
    Text Text Text 139 Text Text Text
    Text Text Text 140 Text Text Text
    Text Text Text 141 Text Text Text
    Text Text Text 142 Text Text Text
    Text Text Text 143 Text Text Text
    Text Text Text 144 Text Text Text
    Total 2937


    Title title Title Title Title Title Title
    Text Text Text 123 Text Text Text
    Text Text Text 124 Text Text Text
    Text Text Text 125 Text Text Text
    Text Text Text 126 Text Text Text
    Text Text Text 127 Text Text Text
    Text Text Text 128 Text Text Text
    Text Text Text 129 Text Text Text
    Text Text Text 130 Text Text Text
    Text Text Text 131 Text Text Text
    Text Text Text 132 Text Text Text
    Text Text Text 133 Text Text Text
    Text Text Text 134 Text Text Text
    Text Text Text 135 Text Text Text
    Text Text Text 136 Text Text Text
    Text Text Text 137 Text Text Text
    Text Text Text 138 Text Text Text
    Text Text Text 139 Text Text Text
    Text Text Text 140 Text Text Text
    Text Text Text 141 Text Text Text
    Text Text Text 142 Text Text Text
    Text Text Text 143 Text Text Text
    Text Text Text 144 Text Text Text
    Total 2937


    Thank you in advance.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro to apply borders to all cells with text and numbers

    I reckon
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Macro to apply borders to all cells with text and numbers

    Hell JP,

    Wow, that is great ;-) it works perfect.

    Thanks a lot for your fast replay.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Macro to apply borders to all cells with text and numbers

    @ Megatronixs

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  7. #7
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Macro to apply borders to all cells with text and numbers

    Hello Cutter,

    Thank you for this. Today when I got home I was searching for this button:-) just a moment ago I managed to mark the first thread as solved and when I came to this tread, it was closed already by you :-)

    I found that star and used it all for BIG thanks to those helping out with the VBA code. Im still learning all those things as this is my first forum Im in :-)
    Thank for those great tips and help around,

    Greetings,
    megatronixs

+ 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