ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to create Cell Comments (https://www.excelbanter.com/excel-programming/352316-macro-create-cell-comments.html)

psmall

Macro to create Cell Comments
 

I am trying to create a macro to create Comments in Cells from text i
adjacent cells. Is this possible

--
psmal
-----------------------------------------------------------------------
psmall's Profile: http://www.excelforum.com/member.php...fo&userid=2764
View this thread: http://www.excelforum.com/showthread.php?threadid=50814


Tushar Mehta

Macro to create Cell Comments
 
Yes, it's possible. Turn on the macro recorder (Tools | Macro Record new
macro...), do whatever it is you want by hand, and turn off the recorder.
In most cases, XL will give you the necessary code that you can then adapt
and customize further.
--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...

I am trying to create a macro to create Comments in Cells from text in
adjacent cells. Is this possible?


--
psmall
------------------------------------------------------------------------
psmall's Profile:
http://www.excelforum.com/member.php...o&userid=27647
View this thread: http://www.excelforum.com/showthread...hreadid=508147



Norman Jones

Macro to create Cell Comments
 
Hi P,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim rCell As Range
Dim sStr As String

Set rng = Selection '<<==== CHANGE

For Each rCell In rng.Cells
With rCell
On Error Resume Next
.Offset(0, 1).Comment.Delete
On Error GoTo 0
.Offset(0, 1).AddComment Text:=.Text
End With
Next rCell
End Sub
'<<=============


---
Regards,
Norman



"psmall" wrote in
message ...

I am trying to create a macro to create Comments in Cells from text in
adjacent cells. Is this possible?


--
psmall
------------------------------------------------------------------------
psmall's Profile:
http://www.excelforum.com/member.php...o&userid=27647
View this thread: http://www.excelforum.com/showthread...hreadid=508147




psmall[_2_]

Macro to create Cell Comments
 

I have tried to do use the recorder and have copied the text but i
copies the exact text into the macro rather than the key process i.e
copy and paste. How do I get it to copy in a relative form rather tha
absolute?

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 03/02/2006 by Philip Small
'

Range("b1").Select
ActiveCell.FormulaR1C1 = "Reversible acid pump inhibitor, Phase I"
Range("A1").Select
Range("A1").Comment.Text Text:="Reversible acid pump inhibitor
Phase I"
Range("B2").Select


End Su

--
psmal
-----------------------------------------------------------------------
psmall's Profile: http://www.excelforum.com/member.php...fo&userid=2764
View this thread: http://www.excelforum.com/showthread.php?threadid=50814


Peter Rooney

Macro to create Cell Comments
 
Good afternoon,

You could try something like this:

Sub Macro1()
Range("E4").Comment.Text Text:=Range("E1").Value
End Sub

to pick up the value of the cell note from cell E1 or

Sub Macro2()
Selection.Comment.Text Text:=Selection.Offset(0, -2).Value
End Sub

to pick up the value of the cell note from the cell two cells to the left

Hope this helps

Have a good weekend

Pete

"psmall" wrote:


I am trying to create a macro to create Comments in Cells from text in
adjacent cells. Is this possible?


--
psmall
------------------------------------------------------------------------
psmall's Profile: http://www.excelforum.com/member.php...o&userid=27647
View this thread: http://www.excelforum.com/showthread...hreadid=508147



Tom Ogilvy

Macro to create Cell Comments
 
Sub BB()
Dim rng As Range
Set rng = Range(Cells(1, 2), Cells(Rows.Count, 2).End(xlUp))
For Each cell In rng
If Len(Trim(cell.Value)) < 0 Then
cell.Offset(0, -1).NoteText Text:=cell.Offset.Text
End If
Next

End Sub

--
Regards,
Tom Ogilvy




"psmall" wrote in
message ...

I have tried to do use the recorder and have copied the text but it
copies the exact text into the macro rather than the key process i.e.
copy and paste. How do I get it to copy in a relative form rather than
absolute?

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 03/02/2006 by Philip Small
'

Range("b1").Select
ActiveCell.FormulaR1C1 = "Reversible acid pump inhibitor, Phase I"
Range("A1").Select
Range("A1").Comment.Text Text:="Reversible acid pump inhibitor,
Phase I"
Range("B2").Select


End Sub


--
psmall
------------------------------------------------------------------------
psmall's Profile:

http://www.excelforum.com/member.php...o&userid=27647
View this thread: http://www.excelforum.com/showthread...hreadid=508147





All times are GMT +1. The time now is 10:52 PM.

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