Convert cell "contents" into a "comment"

R

Ryan

I have a HUGE access database and want to put it into excel. So, I did an
export. Some of the cells have around 350 characters in them and I'd like to
turn those cell contents into "comments" instead. Is there a macro that will
do this for me? It would save me a TON of time.
 
C

Caeres

If you're talking about making them into actual comments, as in the little
bubbles that pop up when you hover over a cell, then it'd be something like
this:

Let's assume you've got cells in the range A1:B7. Here's the code:

Sub Macro1()
'
' Macro1 Macro
'

'
For Each c In [A1:B7].Cells
c.AddComment
c.Comment.Visible = False
c.Comment.Text Text:=c.Value
Next
End Sub

If you want to clear the cells after you add the comments, add this line
before "Next":

c.Value = ""

Hope that's what you're looking for.
 
R

Ryan

That is exactly what I need. I am getting an error with it right now though.
I should note that I have basically zero experience with Macros.

Caeres said:
If you're talking about making them into actual comments, as in the little
bubbles that pop up when you hover over a cell, then it'd be something like
this:

Let's assume you've got cells in the range A1:B7. Here's the code:

Sub Macro1()
'
' Macro1 Macro
'

'
For Each c In [A1:B7].Cells
c.AddComment
c.Comment.Visible = False
c.Comment.Text Text:=c.Value
Next
End Sub

If you want to clear the cells after you add the comments, add this line
before "Next":

c.Value = ""

Hope that's what you're looking for.

Ryan said:
I have a HUGE access database and want to put it into excel. So, I did an
export. Some of the cells have around 350 characters in them and I'd like to
turn those cell contents into "comments" instead. Is there a macro that will
do this for me? It would save me a TON of time.
 
C

Caeres

What error message (hard to give advice unless you describe the problem)?
Also, a way I learn macro syntax is by recording what I want to do, and then
using Edit to look at the code for what I just did.

Ryan said:
That is exactly what I need. I am getting an error with it right now though.
I should note that I have basically zero experience with Macros.

Caeres said:
If you're talking about making them into actual comments, as in the little
bubbles that pop up when you hover over a cell, then it'd be something like
this:

Let's assume you've got cells in the range A1:B7. Here's the code:

Sub Macro1()
'
' Macro1 Macro
'

'
For Each c In [A1:B7].Cells
c.AddComment
c.Comment.Visible = False
c.Comment.Text Text:=c.Value
Next
End Sub

If you want to clear the cells after you add the comments, add this line
before "Next":

c.Value = ""

Hope that's what you're looking for.

Ryan said:
I have a HUGE access database and want to put it into excel. So, I did an
export. Some of the cells have around 350 characters in them and I'd like to
turn those cell contents into "comments" instead. Is there a macro that will
do this for me? It would save me a TON of time.
 
G

Gord Dibben

Couled be that some of the cells contain pure numbers or dates(which are
numbers)

Try this change................

Sub Macro1()
Dim c As Range
For Each c In [A1:B7].Cells
c.AddComment
c.Comment.Visible = False
c.Comment.Text Text:=c.Formula
Next
End Sub


Gord Dibben MS Excel MVP

That is exactly what I need. I am getting an error with it right now though.
I should note that I have basically zero experience with Macros.

Caeres said:
If you're talking about making them into actual comments, as in the little
bubbles that pop up when you hover over a cell, then it'd be something like
this:

Let's assume you've got cells in the range A1:B7. Here's the code:

Sub Macro1()
'
' Macro1 Macro
'

'
For Each c In [A1:B7].Cells
c.AddComment
c.Comment.Visible = False
c.Comment.Text Text:=c.Value
Next
End Sub

If you want to clear the cells after you add the comments, add this line
before "Next":

c.Value = ""

Hope that's what you're looking for.

Ryan said:
I have a HUGE access database and want to put it into excel. So, I did an
export. Some of the cells have around 350 characters in them and I'd like to
turn those cell contents into "comments" instead. Is there a macro that will
do this for me? It would save me a TON of time.
 

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

Top