+ Reply to Thread
Results 1 to 3 of 3

What is the VBA Code for formatting cells?

  1. #1
    Registered User
    Join Date
    12-28-2010
    Location
    Londo
    MS-Off Ver
    Excel 2007
    Posts
    6

    What is the VBA Code for formatting cells?

    Hi All,

    I need to format the borders of some selected cells. I recorded a macro for the same but the piece of code is too long. Please suggest how to program the same effect in one or two lines?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

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

    Re: What is the VBA Code for formatting cells?

    Hi sach83,
    Doing a quick search on xlEdgeLeft found http://msdn.microsoft.com/en-us/libr...ffice.11).aspx So you are wanting 7,8,9,10 from your code above. How about shortening your 4 codes to:

    Please Login or Register  to view this content.
    Looking at the linked page you can get the constant numbers for your no_border() Sub and do a loop for it too.
    Last edited by MarvinP; 01-22-2011 at 01:35 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: What is the VBA Code for formatting cells?

    I like to try this for a complete grid:

    Please Login or Register  to view this content.

    ...and to remove:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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