+ Reply to Thread
Results 1 to 6 of 6

VBA and Conditional Formatting to fill cells with X colour if they contain a comment

  1. #1
    Registered User
    Join Date
    02-13-2021
    Location
    ottawa
    MS-Off Ver
    2017
    Posts
    10

    VBA and Conditional Formatting to fill cells with X colour if they contain a comment

    What I'm trying to do is colour / fill a cell with a colour if that cell has a comment.

    I'm taking inspiration from this post here:

    <I'm not allowed to post links until I post few times>


    What I'm trying is insert this code into vba

    Please Login or Register  to view this content.

    So what I've done is:
    1. hit ALT+F11
    2. right-click in the VBA project window
    3. click insert module
    4. copy and paste the code above
    5. and then click save and save the excel worksheet with macros enabled

    I then add conditional formating logic by:
    1. clicking home
    2. clicking conditional formating
    3. clicking new rule
    4. use formula to determine which cells to format
    5. type exactly this "=IsComm(A1)" without quotes in the "format value where this formula is true" box.
    6. select the colour green from the format button and fill tab.

    below are some pictures of me suffering:
    Attached Images Attached Images
    Last edited by skite0; 02-15-2021 at 05:42 AM. Reason: solution was found

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: VBA and Conditional Formatting to fill cells with X colour if they contain a comment

    Hi, welcome to the forum,

    The only thing that I can see, is that you are formatting cell B7, while you want to format cells A1 or B1

    For me, this works :-)

    Cheers
    Erwin
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    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,197

    Re: VBA and Conditional Formatting to fill cells with X colour if they contain a comment

    Hi, skite0,

    for me I would prefer a macro over a function I would have to fill in for a number of cells to check them.

    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

  4. #4
    Registered User
    Join Date
    02-13-2021
    Location
    ottawa
    MS-Off Ver
    2017
    Posts
    10

    Re: VBA and Conditional Formatting to fill cells with X colour if they contain a comment

    I still can not get this to work, I do not understand why though. I've attached a picture of what I have in my conditional formating window:


    B.png

    I'm not sure if i'm missing something obvious but the way I think this should work is, I put in the conditional formating statement as in the picture (attached to this post), and then I right click a cell and click new comment and then type something and hit enter at which point I expected the cell to turn green.

    The excell is saved as xlsm

    If it is acceptable, can someone upload their excel sheet so I can better compare and contrast to see what I did wrong?
    Last edited by skite0; 02-15-2021 at 04:02 AM.

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

    Re: VBA and Conditional Formatting to fill cells with X colour if they contain a comment

    Newer versions of xl have two types of comments, Comment or Note
    2021-02-15_2-18-07.jpg

    If you want the original comment you need to insert a "note", then your UDF would work.
    If you want to insert a threaded comment you need to change the UDF slightly.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-13-2021
    Location
    ottawa
    MS-Off Ver
    2017
    Posts
    10

    Re: VBA and Conditional Formatting to fill cells with X colour if they contain a comment

    I thought
    Please Login or Register  to view this content.
    was a comment the whole time but
    Please Login or Register  to view this content.
    was indeed the solution.

    Thanks a lot, I would have never caught this

+ 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] Using conditional formatting to fill a cell colour based upon 1 of 2 conditions
    By oneeasygeezer in forum Outlook Formatting & Functions
    Replies: 3
    Last Post: 09-05-2018, 02:39 PM
  2. Conditional Formatting - changing cell fill colour
    By Chamuit in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-05-2017, 03:03 PM
  3. conditional formatting fill cells based on text, how to find sum based on CF colour
    By tubbybear in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-27-2016, 12:04 PM
  4. Conditional formatting - Fill colour and dates
    By JTBS in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-07-2016, 04:47 AM
  5. [SOLVED] Conditional formatting - colour fill entire row by date range
    By oOLILYOo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2012, 10:31 AM
  6. [SOLVED] VBA for conditional formatting colour fill (15 colours) in 2003
    By Russell Dawson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2012, 03:18 PM
  7. Conditional Formatting Fill colour with weekday colour
    By nattasiray in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2008, 06:49 AM

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