cell content into a note

  • Thread starter Thread starter Chuck
  • Start date Start date
C

Chuck

hey guys,

just curious if this can be achieved or how it can be achieved

say i have this

Column A Row 1 = Short Description
Column B Row 1 = Long descriptoin

B2:B10 = are all the short descriptions
B2:B10 = are all the long descriptions

is there a way to just put the comment into the short description
cells from the long description cells via a note and then hide the
long description column?

can anyone advise as to how this can be achieved?
cheers
 
Hi Chuck

This small macro should do the trick

Sub CopyDescToComment()
Dim lr As Long, i As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To lr

Cells(i, 1).AddComment
Cells(i, 1).Comment.Text Text:="" & Cells(i, 2).Value

Next
Columns("B:B").EntireColumn.Hidden = True
End Sub

Copy the macro>Alt+F11>Insert Module>Paste code into white pane>Alt+F11 to
return to Excel sheet.

Tools>Macro>Run>highlight macro name>Run
 
Roger

Your macro will crash if column A already has Comments, giving user no way to
edit column B long descriptions and re-Comment without deleting orignal Comment
in A

I amended to this..........

Sub CopyDescToComment()
Dim lr As Long, i As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To lr
If Cells(i, 1).Comment Is Nothing Then
Cells(i, 1).AddComment
Cells(i, 1).Comment.Text Text:="" & Cells(i, 2).Value
Else
Cells(i, 1).Comment.Text Text:="" & Cells(i, 2).Value
End If
Next
Columns("B:B").EntireColumn.Hidden = True
End Sub


Gord Dibben MS Excel MVP
 
Hi Gord

You are quite right. Thanks for picking that up.
I only tested with a first run through, didn't try again after comments had
been added to cells.
Hard slap on wrist duly administered<bg>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top