VBA & Macro Problems

Copy Excel Cell Text to Notes with VBA

Adam DavisAdam Davis Nov 18, 2026 869 views

Question details

Copy text from cells in column R into notes in the corresponding cells in column P, starting at row 5.

Copy Excel Cell Text to Notes with VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains long text in column R that should appear as a note on the same row in column P.
Observed behavior
Each populated source cell should have its text copied to a note in the corresponding column P cell.
Before you start

Open the workbook in desktop Excel and select the worksheet containing the data. In newer Excel versions, this macro creates legacy notes, not threaded comments; remove any threaded comments from the target cells first.

Solution 1Recommended

Run a VBA macro to copy column R text into column P notes

Use this method to create or replace notes for populated source cells from row 5 through the last used row in column R.

The macro copies the underlying cell value rather than the displayed text, which may be truncated by the column width. It skips blank cells and cells containing errors, and leaves the source values in place.

1
Open the VBA editor

In desktop Excel, press Alt+F11 or open Developer > Visual Basic. In the editor, select Insert > Module.

2
Insert the macro

Paste this code into the module: Sub CopyTextToNotes() Dim w As Worksheet Dim r As Long, lastRow As Long Dim v As Variant Dim previousScreenUpdating As Boolean Set w = ActiveSheet lastRow = w.Cells(w.Rows.Count, "R").End(xlUp).Row If lastRow < 5 Then Exit Sub previousScreenUpdating = Application.ScreenUpdating On Error GoTo CleanUp Application.ScreenUpdating = False For r = 5 To lastRow v = w.Cells(r, "R").Value2 If Not IsError(v) Then If Len(CStr(v)) > 0 Then w.Cells(r, "P").ClearComments w.Cells(r, "P").AddComment w.Cells(r, "P").Comment.Shape.TextFrame.Characters.Text = CStr(v) End If End If Next r CleanUp: Application.ScreenUpdating = previousScreenUpdating If Err.Number <> 0 Then MsgBox "The macro stopped: " & Err.Description End Sub

3
Run the macro

Return to Excel, select the intended worksheet, and choose Developer > Macros. Select CopyTextToNotes and click Run.

4
Check the notes

Point to or select a populated cell in column P to check its note. Use Review > Notes to edit or display notes if needed.

Run a VBA macro to copy column R text into column P notes
Existing notes are replaced: For each nonblank, non-error source cell, the macro clears the existing note in column P before creating a new one. Notes on rows with blank or error values in column R are left unchanged.
Free Microsoft Office alternative

Work with Excel-compatible spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and move everyday spreadsheet work to WPS; the Excel VBA macro above is intended for desktop Microsoft Excel and is not a fix for Excel in WPS.

Open and edit Microsoft Excel XLSX and XLS filesReview spreadsheet data and cell annotations in a familiar interfaceUse a lightweight office suite for everyday spreadsheet workMove compatible Office documents between applications
microsoft office alternative - wps office

Frequently Asked Questions

Does this macro create threaded comments or notes?

It creates legacy notes using VBA's AddComment method. In newer Excel versions, threaded comments are a separate feature.

Will the macro delete existing notes?

It replaces an existing note in column P only when the corresponding column R cell contains a nonblank, non-error value. Other rows are left unchanged.

Can I run this macro in Excel for the web?

No. Open the workbook in desktop Excel to use Developer > Visual Basic and run VBA macros.

Will the notes update when column R changes?

No. The macro copies the current values into notes. Run CopyTextToNotes again from Developer > Macros to refresh them.

How do I keep the macro in the workbook?

Use File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm). Follow your organization's macro security policies when enabling macros.