+ Reply to Thread
Results 1 to 3 of 3

Conditional Formatting based on cell's commentary

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Conditional Formatting based on cell's commentary

    I saw a vba module that detects cell's comments and it works however I'm looking for a custom function that i can use to conditionally format a cell based on the comment's content.

    For example: if comment is "Swap" then it colors the cell green

    i found this, but can't get it to work

    Function Test(rng As Range) As Boolean
    If rng.Comment.Text = "Test" Then
    Test = True
    Else
    Test = False
    End If
    End Function
    Any idea? Thanks!

    -J

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional Formatting based on cell's commentary

    Well, if you want it to work on the word swap you'll need to change "Test" to "Swap". To test if the function is working, put this in B1:

    =Test(A1)

    and you should get FALSE if there is no comment for cell A1, but if there is one and if it is the word swap then you should get TRUE.

    If that works then you should be able to include it within conditional formatting using Formula Is to set up the criteria. like:

    =Test(B2)

    for example.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    02-07-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Conditional Formatting based on cell's commentary

    Thanks for responding! I tried to test the function in B1 with =Test(A1) and got error #Value! Note that cell A1 is empty. Same error when i added a "Test" comment.

    -J

+ 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