VBA & Macro Problems

Copy Excel Cell Contents to the Windows Clipboard Faster

Nimra MalikNimra Malik Nov 14, 2026 868 views

Question details

The user needs a faster way to copy formula text from an Excel cell into another formula bar.

Copy Excel Cell Contents to the Windows Clipboard Faster
Product
Microsoft Excel
Device & OS
Windows
Scenario
The user reviews many formulas stored as text and repeatedly copies individual cell contents into another formula bar.
Observed behavior
The current process requires entering cell edit mode, selecting the contents, copying them, and exiting edit mode.
Before you start

Identify a cell containing the formula text you want to copy. To use the macro, Excel must allow VBA macros and have the Microsoft Forms 2.0 Object Library available.

Solution 1Recommended

Use a VBA macro to copy the selected cell's text

Use this method to copy one cell's formula or value to the Windows clipboard without entering cell edit mode.

The macro copies the selected cell's formula if it contains a formula; otherwise, it copies the underlying value, including a formula stored as text. It does not change the source cell.

1
Open the VBA editor

In Excel, press Alt+F11. Select the workbook in the Project pane, then choose Insert > Module.

2
Enable the Forms library

In the VBA editor, choose Tools > References, select Microsoft Forms 2.0 Object Library, and click OK. If it is not listed, try Insert > UserForm, then check References again.

3
Add the macro

Paste this code into the module: Sub CopyCellText() Dim cell As Range Dim clip As New MSForms.DataObject Dim textToCopy As String If TypeName(Selection) <> "Range" Then Exit Sub If Selection.CountLarge <> 1 Then MsgBox "Select one cell." Exit Sub End If Set cell = Selection If IsError(cell.Value2) And Not cell.HasFormula Then MsgBox "The selected cell contains an error value." Exit Sub End If If cell.HasFormula Then textToCopy = cell.Formula Else textToCopy = CStr(cell.Value2) End If clip.SetText textToCopy clip.PutInClipboard End Sub

4
Run the macro

Return to Excel, select one source cell, press Alt+F8, select CopyCellText, and click Run. You can also use Options in the Macro dialog to assign a shortcut key.

5
Paste the text

Select the destination cell, click its formula bar, and press Ctrl+V. Review the pasted text before pressing Enter.

Use a VBA macro to copy the selected cell's text
Save the macro: To keep the macro in the workbook, use File > Save As and choose Excel Macro-Enabled Workbook (.xlsm). The macro copies formula text as written; it does not adjust cell references as a normal cell copy might.
Copy formula text in WPS Spreadsheets

Copy Cell Contents with WPS Spreadsheets

Use the formula bar in WPS Spreadsheets to select and copy a cell's text, then paste it into another formula bar.

  1. 1. Open the workbook: Open WPS Spreadsheets and use File > Open to select your workbook.
  2. 2. Select the source: Click the cell containing the formula text, then click inside the formula bar.
  3. 3. Copy the contents: Press Ctrl+A to select the formula bar text, then press Ctrl+C. Press Esc to leave the source cell unchanged.
  4. 4. Paste into the destination: Select the destination cell, click its formula bar, and press Ctrl+V. Check the text and press Enter.
Select and copy formula text without dragging across the entire entryOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with spreadsheets using the free WPS Office suite
QA img-9

Frequently Asked Questions

Can I copy a formula stored as text with the macro?

Yes. Select the cell and run CopyCellText through Alt+F8 or its assigned shortcut. The macro copies the cell's underlying text to the clipboard.

Will the macro change the source cell?

No. It reads the selected cell's formula or value and puts the text on the clipboard without editing the worksheet.

Can the macro copy several selected cells at once?

No. This example requires exactly one selected cell. Select an individual cell before running it, including when working with filtered rows.

Why don't cell references adjust when I paste the copied formula text?

The macro copies a text string rather than performing a normal Excel cell copy. Review and update references in the destination formula bar if needed.

What if Microsoft Forms 2.0 Object Library is unavailable?

In the VBA editor, try Insert > UserForm and then look under Tools > References again. If the library is still unavailable, use the formula bar method instead.