PC Review


Reply
Thread Tools Rate Thread

Copy the contents of a range of cells to a single comment(indicator)?

 
 
Mik
Guest
Posts: n/a
 
      29th Apr 2010
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
 
Reply With Quote
 
 
 
 
Mik
Guest
Posts: n/a
 
      29th Apr 2010
On 29 Apr, 23:11, Mik <mhol...@safetysystemsuk.com> 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

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      30th Apr 2010
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 <mhol...@safetysystemsuk.com> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookup cell reference and copy contents and comment from a range GarySW Microsoft Excel Worksheet Functions 0 28th May 2009 06:14 PM
How do I copy the contents of a range of text cells and paste into one cell? davfin Microsoft Excel Misc 7 4th Jul 2006 08:16 AM
Copy column range of "single word" cells with spaces to a single c =?Utf-8?B?bmFzdGVjaA==?= Microsoft Excel Misc 3 15th Feb 2006 05:04 PM
How to I copy text from a range of cells to another single cell? =?Utf-8?B?V1JU?= Microsoft Excel Misc 2 18th Dec 2005 06:17 AM
excel contents cells on different worksheet like a comment =?Utf-8?B?Q2h1cmNoIEFkbWluaXN0cmF0b3I=?= Microsoft Excel Misc 1 31st Aug 2005 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.