+ Reply to Thread
Results 1 to 8 of 8

VB Code for Conditional Formating

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code for Conditional Formating

    Hello:

    Please refer to attached sheet.

    I need a VB code(Macro) to perform conditional formatting in column F from cell F3:F40.
    If there is space after the text then highlight to yellow.

    Example :

    Cell F3 has blank space after "01 BRAZIER" so it should be highlighted.

    Let me Know if you have any questions.
    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VB Code for Conditional Formating

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VB Code for Conditional Formating

    Do you mean you want the macro to apply conditional formatting to column F? Or do you mean you want the macro to do a check and format the cells but not actually apply any conditional formatting to the cells themselves?

    For what it's worth, the formula would be something like:
    =RIGHT(F1,1)=" "
    to return true for your conditional format rule.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VB Code for Conditional Formating

    Hi, riz,

    I think you could use the standard CF as well for this.

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code for Conditional Formating

    Hi HahoBe:

    Please find the attached sheet.
    According to me, red font fields are the only one with blank character after the text string.
    Please re-look and modify the code so that it works.
    thanks and Let me Know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VB Code for Conditional Formating

    Hi, riz,

    F14 has a blank behind the text so the code is working as you required.

    Please Login or Register  to view this content.
    This will exclude all cells starting with Total from the colouring.

    Ciao,
    Holger

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code for Conditional Formating

    Hi HahoBe:

    I am sorry , i was looking at Johns Code but seems like your code is working.
    Thanks a lot and will test further and let you know any issues.
    Riz

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VB Code for Conditional Formating

    It's because the code you used in that attachment was to search for a space anywhere in the text. If you use the macro in post#4 or the "normal" conditional formatting formula I provided in post 3 it will be ok

+ 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. [SOLVED] VB Code for Conditional Formating on Font
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2014, 11:41 AM
  2. Replies: 4
    Last Post: 01-23-2014, 10:14 AM
  3. [SOLVED] Conditional Formating from Color Code Table
    By mycon73 in forum Excel General
    Replies: 16
    Last Post: 11-23-2013, 12:42 AM
  4. Custom Conditional Formating with code Messes up with my VBA scripts
    By evakotsi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2012, 01:10 PM
  5. TextBox Conditional Formating code not working
    By caliskier in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-23-2011, 08:42 PM

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