Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Insert comment into cell

Dear Expert,
Have 2 columns ....
Column A is name
Column B is type
I want the content in column B to put as comments in respective column A.

For example,
Name Type
Elton PT
Jasmine PT
Tony FT, 10
Kammi PT, 12

Would like to put PT as comment in cell A2 (Elton)
Would like to put PT as comment in cell A3 (Jasmine)
Would like to put FT, 10 as comment in cell A4 (Tony)

It can certainly be done manually ... by copy, right click the cell, choose
insert comment .....repeat and repeat ...
I have 1000 cells to be done.
Hope VBA can automate the task. Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Insert comment into cell

Hi,

Try this macro

Sub No_Comment()
Dim c As Range
Dim LastRow As Long
Set Sht = Sheets("Sheet1") ' change to suit
LastRow = Sht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sht.Range("A2:A" & LastRow)
For Each c In MyRange
With c
If .Comment Is Nothing Then
.AddComment c.Offset(, 1).Value
End If
End With
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Elton Law" wrote:

Dear Expert,
Have 2 columns ....
Column A is name
Column B is type
I want the content in column B to put as comments in respective column A.

For example,
Name Type
Elton PT
Jasmine PT
Tony FT, 10
Kammi PT, 12

Would like to put PT as comment in cell A2 (Elton)
Would like to put PT as comment in cell A3 (Jasmine)
Would like to put FT, 10 as comment in cell A4 (Tony)

It can certainly be done manually ... by copy, right click the cell, choose
insert comment .....repeat and repeat ...
I have 1000 cells to be done.
Hope VBA can automate the task. Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Insert comment into cell

Hi Mike,
It does not work.

Stop here .... debug ... highlight this part.
Can you help?

..AddComment c.Offset(, 1).Value
Thanks


"Mike H" wrote:

Hi,

Try this macro

Sub No_Comment()
Dim c As Range
Dim LastRow As Long
Set Sht = Sheets("Sheet1") ' change to suit
LastRow = Sht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sht.Range("A2:A" & LastRow)
For Each c In MyRange
With c
If .Comment Is Nothing Then
.AddComment c.Offset(, 1).Value
End If
End With
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Elton Law" wrote:

Dear Expert,
Have 2 columns ....
Column A is name
Column B is type
I want the content in column B to put as comments in respective column A.

For example,
Name Type
Elton PT
Jasmine PT
Tony FT, 10
Kammi PT, 12

Would like to put PT as comment in cell A2 (Elton)
Would like to put PT as comment in cell A3 (Jasmine)
Would like to put FT, 10 as comment in cell A4 (Tony)

It can certainly be done manually ... by copy, right click the cell, choose
insert comment .....repeat and repeat ...
I have 1000 cells to be done.
Hope VBA can automate the task. Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Insert comment into cell

Mike's code worked ok for me (well, after I dimmed a couple more variables,
<vbg).

So...

Did you change his code?
Is your worksheet protected?
Do you have errors in those adjacent cells?

If you changed his code, post your new version.
If your worksheet is protected, unprotect it first (either in code or manually)
and try again.
If you have errors in those adjacent cells, try using:
..AddComment c.Offset(, 1).Text



Elton Law wrote:

Hi Mike,
It does not work.

Stop here .... debug ... highlight this part.
Can you help?

.AddComment c.Offset(, 1).Value
Thanks

"Mike H" wrote:

Hi,

Try this macro

Sub No_Comment()
Dim c As Range
Dim LastRow As Long
Set Sht = Sheets("Sheet1") ' change to suit
LastRow = Sht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sht.Range("A2:A" & LastRow)
For Each c In MyRange
With c
If .Comment Is Nothing Then
.AddComment c.Offset(, 1).Value
End If
End With
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Elton Law" wrote:

Dear Expert,
Have 2 columns ....
Column A is name
Column B is type
I want the content in column B to put as comments in respective column A.

For example,
Name Type
Elton PT
Jasmine PT
Tony FT, 10
Kammi PT, 12

Would like to put PT as comment in cell A2 (Elton)
Would like to put PT as comment in cell A3 (Jasmine)
Would like to put FT, 10 as comment in cell A4 (Tony)

It can certainly be done manually ... by copy, right click the cell, choose
insert comment .....repeat and repeat ...
I have 1000 cells to be done.
Hope VBA can automate the task. Thanks




--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Insert comment into cell

Thanks mike and dave ....
It works now. Thanks ....

"Dave Peterson" wrote:

Mike's code worked ok for me (well, after I dimmed a couple more variables,
<vbg).

So...

Did you change his code?
Is your worksheet protected?
Do you have errors in those adjacent cells?

If you changed his code, post your new version.
If your worksheet is protected, unprotect it first (either in code or manually)
and try again.
If you have errors in those adjacent cells, try using:
..AddComment c.Offset(, 1).Text



Elton Law wrote:

Hi Mike,
It does not work.

Stop here .... debug ... highlight this part.
Can you help?

.AddComment c.Offset(, 1).Value
Thanks

"Mike H" wrote:

Hi,

Try this macro

Sub No_Comment()
Dim c As Range
Dim LastRow As Long
Set Sht = Sheets("Sheet1") ' change to suit
LastRow = Sht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sht.Range("A2:A" & LastRow)
For Each c In MyRange
With c
If .Comment Is Nothing Then
.AddComment c.Offset(, 1).Value
End If
End With
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Elton Law" wrote:

Dear Expert,
Have 2 columns ....
Column A is name
Column B is type
I want the content in column B to put as comments in respective column A.

For example,
Name Type
Elton PT
Jasmine PT
Tony FT, 10
Kammi PT, 12

Would like to put PT as comment in cell A2 (Elton)
Would like to put PT as comment in cell A3 (Jasmine)
Would like to put FT, 10 as comment in cell A4 (Tony)

It can certainly be done manually ... by copy, right click the cell, choose
insert comment .....repeat and repeat ...
I have 1000 cells to be done.
Hope VBA can automate the task. Thanks




--

Dave Peterson
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert comment to Cell ManhattanRebel Excel Discussion (Misc queries) 1 January 10th 09 01:09 PM
Insert a File, not a Comment, to a Cell Curious[_6_] Excel Programming 1 October 11th 08 02:32 AM
Macro to Insert Comment to a cell wojo Excel Programming 14 July 22nd 05 02:50 PM
Macro to Insert Comment to a cell wojo Excel Programming 0 July 21st 05 04:06 PM
How do I insert a comment when the Insert:Comment menu is greyed? none Excel Discussion (Misc queries) 0 May 19th 05 12:36 AM


All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"