+ Reply to Thread
Results 1 to 9 of 9

Conditional formating using VB

  1. #1
    Registered User
    Join Date
    04-28-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    8

    Conditional formating using VB

    Hi folks,

    I would like to use VB code to conditionally format rows based on some specific conditions:

    The cells in column C will contain a string of text.

    Based on this; If the word ‘APPLES’ appears in that string of text and the word “LOCATION” appears in cell M
    Cell E needs to be shaded red – whilst the rest of the cells of that row are shaded blue.

    Obviously if the conditions are not met the formatting does not take place.

    Could anyone advise on how to achieve this using vb code?

    any help greatly received!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Conditional formating using VB

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Registered User
    Join Date
    04-28-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    8

    Red face Re: Conditional formating using VB

    Thanks for the pointer. Here is an example.
    Attached Files Attached Files

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Conditional formating using VB

    why do you want to use vba instead of regular conditional formats?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Registered User
    Join Date
    04-28-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Conditional formating using VB

    Thinking about if there is a way to specify this using regular conditional formats I could use that - but again I am not sure how to do this

  6. #6
    Registered User
    Join Date
    02-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    46

    Re: Conditional formating using VB

    I have attached an edited version of your workbook that will highlight in the manner that you wish. It adds conditional highlighting based on the following formula:

    Please Login or Register  to view this content.
    This will check that both "apples" appears in column C and "location" appears in column M.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-28-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Conditional formating using VB

    Thanks for the input and this almost does the job. The final part i need is to fill cell E from that row in a different colour Not entirely sure if that's possible?

  8. #8
    Registered User
    Join Date
    02-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    46

    Re: Conditional formating using VB

    Cells in column E should already be highlighted in red as you showed in your example. If you go to Conditional Formatting > Manage Rules > Show formatting rules for: This Worksheet, there should be two separate formatting entries for highlighting the entire row in blue and column E in red. You can re-order the formatting and add/remove formatting options as you see fit. All you need to do is copy that formula into any new rules that you add.

  9. #9
    Registered User
    Join Date
    04-28-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Conditional formating using VB

    Perfect. works a treat! Thanks for your time!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 03-14-2014, 04:03 AM
  2. Replies: 4
    Last Post: 01-23-2014, 10:14 AM
  3. Replies: 6
    Last Post: 08-14-2006, 05:00 PM
  4. Replies: 2
    Last Post: 03-27-2006, 12:10 PM
  5. Install dates formating using conditional formating?
    By Jerry Eggleston in forum Excel General
    Replies: 2
    Last Post: 11-09-2005, 01:49 PM

Tags for this Thread

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