+ Reply to Thread
Results 1 to 6 of 6

Delete blank comments in a selected range

  1. #1
    Registered User
    Join Date
    08-23-2016
    Location
    memphis, tn
    MS-Off Ver
    2010
    Posts
    6

    Delete blank comments in a selected range

    I have a spread sheet with the below VBA code to take the values in the selected cells and turn them into comments on the same cells then fit the comments to there values. I would like to edit it to also delete or not create comments on cells whom's equations return no value. I did not create this VBA as I do not know how. I combined responses from this forum to create the functionality I was desiring. If anyone can help I would appreciate it. Thank you!

    Sub ValueToComment()
    Dim rCell As Range
    For Each rCell In Selection
    With rCell
    If .HasFormula Then
    On Error Resume Next
    .Comment.Delete
    On Error GoTo 0
    .AddComment
    .Comment.Text Text:=CStr(rCell.Value)
    End If
    End With
    Next
    Set rCell = Nothing

    Dim xComment As Comment
    For Each xComment In Application.ActiveSheet.Comments
    xComment.Shape.TextFrame.AutoSize = True
    Next
    End Sub

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Delete blank comments in a selected range

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    08-23-2016
    Location
    memphis, tn
    MS-Off Ver
    2010
    Posts
    6

    Re: Delete blank comments in a selected range

    Thank you. Worked great!

  4. #4
    Registered User
    Join Date
    08-23-2016
    Location
    memphis, tn
    MS-Off Ver
    2010
    Posts
    6

    Re: Delete blank comments in a selected range

    I would like to modify this to pull the values from a sheet named comments on the range B2:E54 and write the values into the comments on a sheet named numbers with the range of B2:E54. Please let me know if this is possible and how if you know how. Thank you!

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Delete blank comments in a selected range

    Try this:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-23-2016
    Location
    memphis, tn
    MS-Off Ver
    2010
    Posts
    6

    Re: Delete blank comments in a selected range

    Thank you. Worked Great!

+ 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. Loop backwards through selected range - delete entire row from selected cells
    By scottbass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2014, 09:21 AM
  2. [SOLVED] If value is blank, delete content in selected cell
    By thelegazy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-25-2013, 01:04 PM
  3. If value is blank, delete content in selected cell
    By thelegazy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-25-2013, 11:52 AM
  4. Delete last row of a selected range
    By nachousa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2010, 07:28 PM
  5. VBA to delete comments from blank cells
    By zoeyandthomas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2010, 04:55 PM
  6. Delete Blank Rows-Blank Row between my data range
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-27-2010, 02:52 PM
  7. Delete selected range
    By RW in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2005, 09:00 AM
  8. delete every nth row in selected range
    By cwinters in forum Excel General
    Replies: 1
    Last Post: 07-06-2005, 04:05 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