macro to insert comment

T

Theo

Hi all - I've been looking for some sample code to do the following.

I'm looking for a macro that will first check if the cell in column E has
data; if it does, I want to cut the data (it will be txt) from the cell in
column E and insert it as a comment in column A, and do that for each row in
the worksheet. I looked through this site and Contextures and couldn't find a
sample.

Any help always appreciated!
Theo
 
J

Jacob Skaria

Dear Theo

Try the below macro

Sub Macro1()

Adjust the number of rows as per your requirement

For lngRow = 1 To 100
If Trim(Range("E" & lngRow)) <> "" Then
Range("A" & lngRow).ClearComments
Range("A" & lngRow).AddComment Range("E" & lngRow).Text
Range("E" & lngRow) = ""
End If
Next

End Sub

If this post helps click Yes
 

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