+ Reply to Thread
Results 1 to 7 of 7

Macro for Conditional Formatting code to get Coloured Borders?

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Macro for Conditional Formatting code to get Coloured Borders?

    How do I write a Macro for Conditional Formatting code to get Borders?

    I want to create a sheet with a Macro and I want to create simple borders around the Cells uptill the last filled cell.

    Ex: Data is from Col A till Col K

    If there data in the column B then there should be borders around the entire ROW from Col A till Col K.

    This whole sheet will be devoid of GridLines and therefore the only borders present will be due to the conditional formatting or if there's any other way of making.

    So Any ideas..!

    Warm regards
    e4excel
    Last edited by e4excel; 07-25-2011 at 08:16 AM. Reason: Moderator's Request

  2. #2
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: How do I write a Macro to write code in a Conditional Formatting coloured borders

    + select data A1:K10 for an example

    + format / conditional formatting
    with conditional 1:
    Formula is : $B2<>""
    (or cell not BLANK)
    press Format... button, then format such borders surrounding the cells as you want

    + then press OK
    Best regard, -)iger-/iger
    If you are pleased with a solution mark your post SOLVED.

  3. #3
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: How do I write a Macro to write code in a Conditional Formatting coloured borders

    Dear TG,

    I am aware of writing the CF however I wanted to know know whether I can write the same with a Macro or if there was a better way of getting the desired result..

  4. #4
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: How do I write a Macro to write code in a Conditional Formatting coloured borders

    oh, if like that, you can record a macro capture what you do, then eliminating its redundant code

    a macro such that

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: How do I write a Macro to write code in a Conditional Formatting coloured borders

    Dear Tiger,

    This works the way I wanted but have some questions?

    1. How to make it more dynamic ? lets say the range can always keep on expanding...
    (Rowwise)


    2. How to add more conditions in the Conditional Formatting?

    My actual condition which I was using by manually writing the formula was as below:

    1> =$A2<>"" Format to get a Blue Colour border in the shape of a "U" without the top Border..

    2> =AND($A2="",$A3="") WITH NO bORDER....

    Warm Regards
    e4excel

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How do I write a Macro to write code in a Conditional Formatting coloured borders

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Macro for Conditional Formatting code to get Coloured Borders?

    Dear Tiger,

    I have actually Five COnditions in the regular Manual Conditional Formatting that helps me get Border, however I want to write it with a Macro..

    So can you please explain me the same...

    OR

    Alternatively, is there a direct way of achieving the same with a VBA code, I would prefer both options for learning however for all practical purposes I need to create a copy of the main file and the conditional formatting cannot be avoided as it goes with the COPY_PASTED Sheet too as without the Conditional FOrmatting the Automatic Borders dont take place...


    Warm Regards
    e4excel
    Last edited by e4excel; 08-04-2011 at 03:29 PM.

+ 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