ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy the contents of a range of cells to a single comment(indicator)? (https://www.excelbanter.com/excel-programming/442176-copy-contents-range-cells-single-comment-indicator.html)

Mik

Copy the contents of a range of cells to a single comment(indicator)?
 
How do you copy the contents of a range of cells to a single comment
(indicator)?

I have a range of cells ("n12:n14"), and want to copy the contents
into a single comment indicator within the activecell.

anybody help?

Thanks
Mik

Mik

Copy the contents of a range of cells to a single comment(indicator)?
 
On 29 Apr, 23:11, Mik wrote:
How do you copy the contents of a range of cells to a single comment
(indicator)?

I have a range of cells ("n12:n14"), and want to copy the contents
into a single comment indicator within the activecell.

anybody help?

Thanks
Mik


I Have an addition / further thought....

I wish to add the selected text from a 3 column listbox (userform) to
the active cell as a comment (with indicator).

Can anybody advise how this is done using vba?

Mik


Dave Peterson

Copy the contents of a range of cells to a single comment(indicator)?
 
I created a small userform with a listbox and two commandbuttons on it (ok and
cancel).

This was the code behind the userform:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim myStr As String

If Me.ListBox1.ListIndex < 0 Then
Exit Sub 'nothing chosen yet
End If

With Me.ListBox1
myStr = .List(.ListIndex, 0) _
& "--" & .List(.ListIndex, 1) _
& "--" & .List(.ListIndex, 2)
End With

With ActiveCell
If .Comment Is Nothing Then
'no existing comment
Else
.Comment.Delete
End If
.AddComment Text:=myStr
End With

End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long

With Me.ListBox1
.ColumnCount = 3
.ColumnWidths = "30,30,30"
'add some test data
For iCtr = 1 To 3
.AddItem "A" & iCtr
.List(.ListCount - 1, 1) = "B" & iCtr
.List(.ListCount - 1, 2) = "C" & iCtr
Next iCtr
End With

End Sub


Mik wrote:

On 29 Apr, 23:11, Mik wrote:
How do you copy the contents of a range of cells to a single comment
(indicator)?

I have a range of cells ("n12:n14"), and want to copy the contents
into a single comment indicator within the activecell.

anybody help?

Thanks
Mik


I Have an addition / further thought....

I wish to add the selected text from a 3 column listbox (userform) to
the active cell as a comment (with indicator).

Can anybody advise how this is done using vba?

Mik


--

Dave Peterson


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com