+ Reply to Thread
Results 1 to 5 of 5

Substituting Conditional Formatting Code with VBA Macro

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

    Substituting Conditional Formatting Code with VBA Macro

    Substituting Conditional Formatting Code with VBA Macro

    Is it possible to Susbtitute Conditional Formatting with VBA Macro?
    I need to desperately write a code in VBA but do not know how to implement the same..

    AS in CF we write the codes for particular cells however they apply to a Range, so how to do the same in VBA ?

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

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Susbtituting Conditional Formatting Code with VBA Macro

    e4excel,

    I'm not sure why you would choose to use VBA over conditional formatting, but you can use the following as an example to get started. It looks at column A and any cell that is 0 it fills red. Make sure to put the code in the desired worksheet's Event module:
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar

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

    Re: Susbtituting Conditional Formatting Code with VBA Macro

    Thanks for keeping my Hopes Alive TIger Avatar...

    I will now post the actual file which has around 5 Conditions to get BORDERS around the filled Data Range..

    For confidential reasons I cannot post the Main Data Sheet from where the Data is fed into this Sheet which needs to be distributed but without any conditional formating code.

    The File I am going to attach for reference is just a structure of the original file in which the VBA Code OR ALTERNATIVELY if anything better can be added..

    I have 5 Conditional Formatting condition with the help of which I get Borders aroungd my Data in the SHeet...

    Condt 1 =AND($C2=" ",$C1>=1) Top Border


    Condt 2 =AND($C2<>1,$C2>=$C1,$C2<>" ",$C3=" ") Dotted Top Border


    Condt 3 =AND($C2=1,$C3>=$C2) Dotted Bottom Border


    Condt 4 =$C2>1 Dotted Top & Bottom


    Condt 5 =AND($C2>=1,OR($C3=" ",$C3=0)) Non-Dotted Square

    There are 2 Colours DARK PURPLE and TAN...

    The DARK PURPLE are the XLTHIN Borders and the TAN are the XLDOTTED borders.

    PFA , please feel free to change the conditional formatting code if the need be but please help me with a VBA code....

    Warm Regards
    e4excel
    Attached Files Attached Files

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

    Re: Susbtituting Conditional Formatting Code with VBA Macro

    Dear Tiger,

    Please check if this can be done via VBA.

    Reg

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

    Bump NO Response

    Bump NO Response

+ 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