• Excel Video Tutorials

How to Copy Cell without New Line Break in Excel?

Generally, in Excel, when we copy data from a sheet and try to paste it in a notepad, the cursor will move to the next line after pasting the data. When you don't want to move the cursor to the next line, you can keep it on the same line. We can complete the task with the help of a VBA application, as it can’t be completed directly in Excel.

Read this tutorial to learn how to copy in Excel without adding a new line break. Even though it can be a lengthy process, it can be a simple one.

Copying Cell Without New Line Break in Excel

Here we will first open the VBA application, then create a module and a macro to complete our task. Let us look at a simple procedure for copying a cell in Excel without creating a new line break using the vba application.

Step 1

Open an Excel sheet. Right-click on the sheet name and select view code to open the VB application, then click on Insert, select Module, and enter the below-mentioned programme in the textbox as shown in the below image.

Right click > View code > Insert > Module > Programme


Sub CopyText()
'Updated by Nirmal
    Dim xAutoWrapper As Object
    Set xAutoWrapper = New DataObject  'or GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    xAutoWrapper.SetText ActiveCell.Text
End Sub

Step 2

Then click on tools, select references, click on browse in the pop-up, enter the reference as Windows\system32 and enter the file name as FM20.DLL and click open.

Tools > References > Browse > Reference > File Name

Step 3

Then press ALT + Q to exit the VBA application. Then, select developer, macros, option, create the shortcut with the letter "R," and click OK.

Alt + Q > Developer > Macro > Options > R > Ok

Step 4

Now click on the cell you want to copy and use the command CTRL + SHIFT + R to copy the data. In the notepad, use the command CTRL + V to paste the data, and our result will be similar to the below image.

Cell > CTRL + SHIFT + R > CTRL + V


In this tutorial, we used a simple example to demonstrate how you can copy cells without a new line break in Excel.