Results 1 to 8 of 8

comment based on cell value in protected sheet

Threaded View

  1. #1
    Registered User
    Join Date
    11-06-2014
    Location
    India
    MS-Off Ver
    7
    Posts
    19

    comment based on cell value in protected sheet

    I used following vba for comment based on cell value, but when sheet is protected its not working (message .. Run time error '91': prompting for debug)

    Sub addCommnent()
    ''that cell is A1
    Dim commentTxt As String, commentRng As Range
    Set commentRng = Range("B4")
    commentTxt = Range("M15").Value
    On Error Resume Next
    
    With commentRng
    .Comment.Delete
    .AddComment commentTxt
    
    End With
    End Sub
    Sub addCommtent()
    ''that cell is A2
    Dim commentTxt1 As String, commentRng1 As Range
    Set commentRng1 = Range("B5")
    commentTxt1 = Range("N15").Value
    On Error Resume Next
    
    With commentRng1
    .Comment.Delete
    .AddComment commentTxt1
    
    End With
    End Sub
    Private Sub Worksheet_Calculate()
    If Range("B4").Comment.Text <> Range("M15").Value Then addCommnent
    If Range("B5").Comment.Text <> Range("N15").Value Then addCommtent
    End Sub
    please guide where I am wrong
    Last edited by AliGW; 07-18-2018 at 02:10 AM. Reason: Code tags amended.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 05-22-2018, 03:04 PM
  2. VBA Code to unlock cells on a protected sheet based on cell value in another worksheet
    By mr_irrelevant in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2014, 04:02 PM
  3. Insert cell comment on a protected sheet
    By LAF in forum Excel General
    Replies: 4
    Last Post: 07-22-2009, 05:49 AM
  4. [SOLVED] How do I create a comment on an unlocked cell in a protected sheet
    By LObeidat in forum Excel General
    Replies: 1
    Last Post: 07-25-2006, 08:20 AM
  5. [SOLVED] [SOLVED] Adding a Comment on a protected sheet
    By Sean in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2006, 02:05 PM
  6. How do I insert a comment in unlocked cell of a protected workshee
    By TD_Anne in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-16-2006, 03:30 PM
  7. Comment and autofilter in cell of protected sheet
    By Hall in forum Excel General
    Replies: 1
    Last Post: 04-25-2005, 08:06 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