+ Reply to Thread
Results 1 to 10 of 10

Conditional Formatting VBA

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Conditional Formatting VBA

    Hi,
    I am using following macro for conditional formatting (6 conditions) and this working well. But the only problem I have is that when I delete the data from column it does not retrieve to no fill (no color). I have my values in column M, O & Q. Please help me.
    Please Login or Register  to view this content.
    I have tried to add following code but then nothing works i.e. there is no color change even for above conditions.
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Conditional Formatting VBA

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

    Please Login or Register  to view this content.
    hope it helps,
    Mohammad

  3. #3
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting VBA

    No it doesn't help as it reads any of the empty cell from M to Q while I want that when there is no value in columns M,O and Q then It should change to white background / no color. But if there is any given value in any of the three columns then it should change the color.
    Further Can I have more than one change sheet event code in same worksheet as I am trying to wirte down sepeate codes for each column M, O & Q but when I change the names of macros like
    Please Login or Register  to view this content.
    then it does not work.
    I hope now its more clear and you can suggest something to solve this issue.

    Thanks

  4. #4
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Conditional Formatting VBA

    Did you try the second code I provided?
    Please Login or Register  to view this content.
    this checks if the cell is empty ore not and if it is empty it will clear the formatting.

    about having more than 1 change functions you can't do that, however you can in the same function check the changed range using the Target argument and write your action for example:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting VBA

    I tried your code of empty cell but its not getting the required result as I told you before that it reads any of the empty cell from M to Q which I dont want. I explain you my logic and then I think you can better create a code to fulfill the purpose. What I want is that When there is "First Reminder Due" or "First Reminder Sent" in Column M then row color should be "50" or "10" respectively. Similarly when there is "Second Reminder Due" or "Second Reminder Sent" in Column O then color should be "40" or "46" respectively and finally when there is "Final Reminder Due" or "Final Reminder Sent" in Column Q then color should be "38" or "3" respectively. But when there is no value in Column M, O or Q then there should be no row color. Or you can restict it to Column M only which means when Column M is empty then row background color should be white.
    Hope now you can better help me.

    Thans for your concen.

  6. #6
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Conditional Formatting VBA

    Dear AssifShabbir,

    I hope I have understood you correctly this time,
    please try the following code:

    Please Login or Register  to view this content.
    I hope this helps,
    Mohammad

  7. #7
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting VBA

    Thanks for your reply but it is not working as I explained you before that there are five columns when we set range M:Q and the code reads information from all five columns when we set Case Empty while what I desire is that when only three M,O & Q are empty simultaneously then there should be no color or even when M is empty then row color should be white.
    However I have found a solution by putting this 7th condition in normal conditional formatting which is when Column M is empty then row color should be white.
    But still I want your help as the code above (macro) is set to autorun (change by value) and I have some date (Today's date) formulae in Column M, O and Q. Problem is that when date is changed some fields are populated like "First Reminder Due" etc but the code does not treat it as change in value and it does not triggered unless I put something in any of the column manually.
    Is there any way for triggering the code without putting something manually? I mean it should read the information in column M, O & Q when these are changed as a result of formula when the worksheet is opened.
    I hope I am not bothering you. Thanks for your help.

  8. #8
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Conditional Formatting VBA

    maybe you want to use the WorkSheet Calculate event instead of the change event like below:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Conditional Formatting VBA

    Yes It works. Thanks alot for your throughout support.

  10. #10
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Conditional Formatting VBA

    you are welcome

+ 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