Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Comments to a Cell - Multi Line

Status
Not open for further replies.

moestroz

MIS
Jul 29, 2004
8
US
I am trying to add comments to a cell, but with multiple lines...any clues?

When I use the GUI interface (right click a cell, insert comment, and then I can type mutliple lines of text. How do you get it done in VBA?

On a particular cell, I want 5 lines of data. Here is my code so far.

First I am setting up some variables to store cell info into:

PartID = Cells(nRow, 9).Value
WorkOrder = Cells(nRow, 10).Value
SeqNo = Cells(nRow, 15).Value
Resource = Cells(nRow, 17).Value
WORecv = Cells(nRow, 12).Value
WOQty = Cells(nRow, 11).Value
OperQty = Cells(nRow, 18).Value

Then at a different cell in the worksheet, I want to record the info on 5 lines of comments.

With Cells(WOLin, nCol).AddComment
.Visible = False
.Text PartID
.Text WorkOrder & " / " & SeqNo & " " & Resource
' .Text "WO Recd = " & WORecv
' .Text "WO Desired = " & WOQty
' .Text "OperQty = " & OperQty
.Shape.TextFrame.AutoSize = True
End With


It just always takes the last text line. So right now, all I get is:
W32060 / 30 PLTPAS

I want to get:
TAYL0097
W32060 / 30 PLTPAS
WO Recd = 0
WO Desired = 100,000
OperQty = 2,000

Any help would be appreciated!
TIA,
moestroz
 
have a play with:

vbcrlf
Char(10)
Char(13)


Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Like this ?
Code:
Cells(WOLin, nCol).AddComment
With Cells(WOLin, nCol).Comment
    .Visible = False
    .Text PartID & Chr(10) _
      & WorkOrder & "  /  " & SeqNo & " " & Resource & Chr(10) _
      & "WO Recd = " & WORecv & Chr(10) _
      & "WO Desired = " & WOQty & Chr(10) _
      & "OperQty = " & OperQty
    .Shape.TextFrame.AutoSize = True
End With

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top