+ Reply to Thread
Results 1 to 6 of 6

Border Macro

  1. #1
    Registered User
    Join Date
    02-08-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    80

    Border Macro

    Hi,

    Can someone assist me. I have recorded a macro which will create the border for me when the file is opened, but it turned out too long. if someone can show me how to reduce the codeing. I have the attached file.

    Range A5 to E20 thin Border all sides and thick border allround (16 rows)
    Range A21 to E36 thin border all sides and thick border allround (16 rows)

    end range is A356.

    If someone can guide me much appricated.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Border Macro

    Tru this macro

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Border Macro

    Hello coolhit,

    Here is more compact version of Mudrakers's code. Place this in a standard VBA Module in your workbook's VBA project.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    02-08-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    80

    Re: Border Macro

    Quote Originally Posted by Leith Ross View Post
    Hello coolhit,

    Here is more compact version of Mudrakers's code. Place this in a standard VBA Module in your workbook's VBA project.
    Please Login or Register  to view this content.
    Hi Above code worked but only bit of it.

    i.e Set Rng = Range("A5:E36") i changed it to E356 as this was may last row.
    Macro did put thick border around A5toE20 and then it did A21toE356 as one hold block insted of next16 row A21 to E36.

    Thick border is round every 16 rows and start row is A5 and end row is E356.

    I do like the short version. how do i make it do every 16 rows thick border.

    Many thanks

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Border Macro

    Hello coolhit,

    The macro has been annotated to show what is happening and gain a better understanding of the code. I expanded the macro to automatically find the end of the data range using the second column of defined data range. The start of your range is from "A5:E5". The second column is then "B". If the range were "F5:J5" then the macro would use column "F". You only need to enter the first row the range in the code. It is marked in red.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-08-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    80

    Re: Border Macro

    Hi

    Thankyou

    Last codeing worked a treat and gave me better understanding of the codeing.

    Many Thanks once again.

+ 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