Results 1 to 5 of 5

Show comments next to selected cell

Threaded View

  1. #1
    Forum Contributor Marco-Kun's Avatar
    Join Date
    04-14-2009
    Location
    Holland
    MS-Off Ver
    Dutch:2007
    Posts
    298

    Show comments next to selected cell

    I have a spreadsheet with several comments with pictures on cells. I want them to show up when you select the cell, instead of having to put your mouse cursor on it. I found this code, but then it shows the comment on the middle of the spreadsheet. I want the comments to show next to the selected cell. How can I do this?

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
     'www.contextures.com/xlcomments03.html
     Dim rng As Range
     Dim cTop As Long
     Dim cWidth As Long
     Dim cmt As Comment
     Dim sh As Shape
     
     Application.DisplayCommentIndicator _
        = xlCommentIndicatorOnly
     
     Set rng = ActiveWindow.VisibleRange
     cTop = rng.Top + rng.Height / 2
     cWidth = rng.Left + rng.Width / 2
    If ActiveCell.Comment Is Nothing Then
      'do nothing
    Else
      Set cmt = ActiveCell.Comment
      Set sh = cmt.Shape
      sh.Top = cTop - sh.Height / 2
      sh.Left = cWidth - sh.Width / 2
      cmt.Visible = True
    End If
    
    End Sub
    Thanks
    Marco
    Last edited by Marco-Kun; 04-16-2009 at 07:18 AM. Reason: Prefix; Solved

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