Results 1 to 7 of 7

inserting comments to cells based on the values of that cell and one other cell (VBA)

Threaded View

  1. #1
    Registered User
    Join Date
    01-06-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    2

    inserting comments to cells based on the values of that cell and one other cell (VBA)

    Hi all,

    I wish to set up a condition on cell whereby a comment box appears automatically if the user enters a certain value into that cell, BUT another cell (D12) is left blank.

    If the 'conditional' cell is blank (or equal to zero), and the cell itself (D29) is not equal to zero, then I want a comment appears to say "error".

    The code I have tried using is shown below. FYI it works with one criteria ie no "And Range("D29:AP29")", but i need both criteria to be accounted for in order for the condition to work.


    Private Sub Worksheet_Calculate()
       Dim rCell As Range
    
       Set rCell = Range("D29:AP29")
       On Error Resume Next
       rCell.Comment.Delete
       On Error GoTo 0
       If Range("D12:AP12") <> 0 And Range("D29:AP29") = 0 Then rCell.AddComment ("error")
    End Sub
    Any help would very much appreciated!!

    Thanks,

    Michael
    Last edited by Richard Buttrey; 01-06-2016 at 11:53 AM. Reason: missing code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 06-27-2015, 03:21 PM
  2. [SOLVED] copy cell values in one cell based on value of adjacent cells
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2014, 08:48 AM
  3. Inserting images into a cell based on another cells value.
    By ccScotty in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2012, 12:08 PM
  4. Inserting cells to the left based on cell value
    By Judge Dredd in forum Excel General
    Replies: 5
    Last Post: 03-11-2011, 04:39 AM
  5. Replies: 11
    Last Post: 07-26-2008, 05:18 AM
  6. [SOLVED] anchor comments to cell while inserting and deleting rows
    By db55ford in forum Excel General
    Replies: 1
    Last Post: 06-16-2006, 09:30 PM
  7. UDF code to find specific text in cell comments, then average cell values
    By bruch04 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-05-2005, 06:10 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