Replace text in cell with text from comment

kalagas

New Member
Joined
Feb 15, 2019
Messages
25
Hi to all.
I was wondering if there is a vba to search inside entire sheet and to do the following:
In cells that there are comments, then replace the text inside these cells with the text of the comments of these cells.
The cells that don't have comments to be leaved as they are.

So i am looking for a batch process to do the above but in sheets i needed not in all workbook.
F.e if a file has sheets 2020, 2021, 2022, 2023 to be able to choose in which sheets of these will run the vba.

Thanks in advance for your time,
Yiannis St
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Are you referring to the old style comment (now called notes), or the new style Comments?
 
Upvote 0
Cross posted Replace text in cell with text from comment

While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
That is not what I asked. Could you please answer my question?
Also please acknowledge post#3
 
Upvote 0
Ok this is solved. The following code from cross-post worked for me.
VBA Code:
Sub ShowCommentsOwnCell()

  Application.ScreenUpdating = False

  Dim commrange As Range
  Dim mycell As Range
  Dim WS As Worksheet
  
  Set WS = ActiveSheet

  On Error Resume Next
  Set commrange = WS.Cells.SpecialCells(xlCellTypeComments)
  On Error GoTo 0

  If commrange Is Nothing Then
     MsgBox "no comments found"
     Exit Sub
  End If

  For Each mycell In commrange
      mycell.Value = mycell.Comment.Text
  Next mycell

  Application.ScreenUpdating = True

End Sub
 
Upvote 0
Glad you got it sorted & thanks for letting us know.
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,282
Members
449,094
Latest member
GoToLeep

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top