+ Reply to Thread
Results 1 to 2 of 2

Using values of cells in a comment

  1. #1
    Bamaopoly
    Guest

    Using values of cells in a comment

    MS Excel 2003
    I'm writing a macro that will insert a comment in a cell based upon the cell
    value. For instance,
    A B C D E
    1 Address City State Phone 1

    What I want to happen is that if E1 = 1 then
    Insert a comment in cell E1 as follows:
    A1
    B1, C1
    D1

    to read
    Street
    City, State
    Phone

    I've got the AddComment working, but how do I pull the values of A1-D1 to
    use as text in the comment?

    Any help would be appreciated, thanks in advance.


  2. #2
    Bamaopoly
    Guest

    RE: Using values of cells in a comment

    YES! Thanks man! Here's the code I was working with and now does what I
    want, now I just need to trim it:

    Range("a1:e3").ClearComments
    For col = 1 To 5
    For Row = 1 To 3
    If Cells(Row, col) = 1 Then
    Cells(Row, col).AddComment
    Cells(Row, col).Comment.Visible = False
    Cells(Row, col).Comment.Text Text:=Cells(Row, 6).Value & Chr(10)
    & Cells(Row, 7).Value & ", " & Cells(Row, 8).Value & Chr(10) &
    Cells(Row, 9).Value
    End If
    Next
    Next

    Thanks again.
    JC

    "Tom Ogilvy" wrote:

    > Sub ABC()
    > For Each Cell In Range("E1:E5")
    > If Cell.Value = 1 Then
    > With Cell.Offset(0, -4)
    > s = .Range("A1").Value & _
    > Chr(10) & Range("B1").Value _
    > & ", " & Range("C1").Value _
    > & Chr(10) & Range("D1").Value
    > End With
    > Cell.NoteText s
    > End If
    > Next
    > End Sub
    >
    > worked for me.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Bamaopoly" wrote:
    >
    > > MS Excel 2003
    > > I'm writing a macro that will insert a comment in a cell based upon the cell
    > > value. For instance,
    > > A B C D E
    > > 1 Address City State Phone 1
    > >
    > > What I want to happen is that if E1 = 1 then
    > > Insert a comment in cell E1 as follows:
    > > A1
    > > B1, C1
    > > D1
    > >
    > > to read
    > > Street
    > > City, State
    > > Phone
    > >
    > > I've got the AddComment working, but how do I pull the values of A1-D1 to
    > > use as text in the comment?
    > >
    > > Any help would be appreciated, thanks in advance.
    > >


+ Reply to Thread

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