+ Reply to Thread
Results 1 to 3 of 3

Default Code to Insert Comments Based on Adjacent Cell Value?

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    63

    Default Code to Insert Comments Based on Adjacent Cell Value?

    I have 2 columns of values. Column A has payments, and Column B has descriptions of each. I need to delete Column B, but first add the values as a comment to the adjacent cells in Column A. Also must insert no comment when Column B is blank. I know this should not be that hard, but I cannot get the code to work. Thank you for any help!!

    http://i.imgur.com/W8AfoPd.png

    W8AfoPd.png

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Default Code to Insert Comments Based on Adjacent Cell Value?

    Please Login or Register  to view this content.
    Last edited by Neil_; 01-06-2016 at 02:23 PM.
    Frob first, tweak later

  3. #3
    Registered User
    Join Date
    06-13-2012
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    63

    Re: Default Code to Insert Comments Based on Adjacent Cell Value?

    Quote Originally Posted by Neil_ View Post
    Please Login or Register  to view this content.
    Ended up using the code below but thank you so much! Marked as solved :D

    Sub ConvertToComment()

    Dim lastRow As Long, i As Long
    Dim commentContents As String

    lastRow = Range("A1048576").End(xlUp).Row

    For i = 1 To lastRow
    If Cells(i, 2) <> "" Then
    commentContents = Cells(i, 2)
    Cells(i, 1).AddComment
    Cells(i, 1).Comment.Text Text:=commentContents
    Cells(i, 2).ClearContents
    End If
    Next i

    End Sub

+ 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. code to copy content to adjacent cells based on a cell value
    By anbarasi_r in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-28-2015, 12:42 PM
  2. Automatically insert and\or change comments based on vlookup of cell value
    By LeanneExcel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2014, 12:23 AM
  3. [SOLVED] How to insert default Signature in Code
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-14-2014, 03:39 PM
  4. VBA Code to Make a Cell Value Negative Based on Content of Adjacent Cell
    By Court Manager in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-08-2014, 04:18 PM
  5. Default Setting for Object Positioning of Cell Comments
    By Gingeiko in forum Excel General
    Replies: 0
    Last Post: 12-09-2011, 02:18 AM
  6. Sumproduct based on adjacent cell ID Code
    By avidcat in forum Excel General
    Replies: 6
    Last Post: 05-03-2009, 02:38 PM
  7. [SOLVED] how do I insert a cell based on its match with an adjacent cell?
    By Gabbon in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-24-2006, 08:30 AM

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