ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Inserting Comments en mass (https://www.excelbanter.com/excel-discussion-misc-queries/164573-inserting-comments-en-mass.html)

Heather

Inserting Comments en mass
 
I am working with Excel 2003

I have a spreadsheet with a list of Employee Names in column A, and a list
of Employee Numbers in column B.

I would like to be able to move all of the Employee Numbers into comments
for the coresponding Employee name. Is there a way to cut/paste/insert and do
this? I tried copying and then pasting special using the Comments option, but
it didn't do what I want...

This seems like it would be a very basic and usable function, does it exist?

Wigi

Inserting Comments en mass
 
Hi Heather

Here's a bit of code to do it:

Sub NumberToComments()

Dim r As Range

Application.ScreenUpdating = False

For Each r In Columns(1).SpecialCells(xlCellTypeConstants, xlTextValues)
r.AddComment
r.Comment.Text Text:=CStr(r.Offset(, 1).Text)
Next

Application.ScreenUpdating = True

End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Heather" wrote:

I am working with Excel 2003

I have a spreadsheet with a list of Employee Names in column A, and a list
of Employee Numbers in column B.

I would like to be able to move all of the Employee Numbers into comments
for the coresponding Employee name. Is there a way to cut/paste/insert and do
this? I tried copying and then pasting special using the Comments option, but
it didn't do what I want...

This seems like it would be a very basic and usable function, does it exist?


Heather

Inserting Comments en mass
 
I'm sorry! I'm confused. Is that HTML, or something I should copy/paste into
the cell like regular excel codes?

"Wigi" wrote:

Hi Heather

Here's a bit of code to do it:

Sub NumberToComments()

Dim r As Range

Application.ScreenUpdating = False

For Each r In Columns(1).SpecialCells(xlCellTypeConstants, xlTextValues)
r.AddComment
r.Comment.Text Text:=CStr(r.Offset(, 1).Text)
Next

Application.ScreenUpdating = True

End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Heather" wrote:

I am working with Excel 2003

I have a spreadsheet with a list of Employee Names in column A, and a list
of Employee Numbers in column B.

I would like to be able to move all of the Employee Numbers into comments
for the coresponding Employee name. Is there a way to cut/paste/insert and do
this? I tried copying and then pasting special using the Comments option, but
it didn't do what I want...

This seems like it would be a very basic and usable function, does it exist?



All times are GMT +1. The time now is 02:31 PM.

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