

You will remove all the spaced in a cell. By modifying the range in codes, the result can be produced in your target cells. You can either remove all spaces or just remove the additional spaces according to your need.Ģ. If you are not familiar with VBA macros, you can use functions to solve the problem.ġ. There are two different formulas that you can choose according to your need.Ģ. This method is easy to understand, and almost all the Excel users can apply this method.ġ. The result will immediately appear in the current cells.Ģ. The table below shows the advantages and disadvantages of the above methods.ġ. Range("B2") = (Range("A1"))Īfter you run the macro, you will see that the necessary spaces are still in cells. On the other hand, if you need to keep the spaces between words, you can use the worksheet function in VBA codes. You will find that all the spaces are removed. Next you can come back to the worksheet and check the result. On the other hand, you can also press the button “F5” on the keyboard to run macro.

This macro will remove all the spaces in a cell. In this step, copy the following codes and paste into the module.Thus, you have inserted a new module in the project. In the sub menu, choose the option “Module”.And then click the button “Insert” in the toolbar.Press the button “Alt + F11” on the keyboard to open the Visual Basic editor.Method 3: Excel MacrosĮxcept for the above two methods, you can also use Excel macros to remove spaces.

Thus, this formula will remove all the spaces in a cell.įor the above two formulas, you can choose one formula according to your need. The second argument in this formula is a space, and the third argument is nothing. On the other hand, if you need to remove all the spaces in target cells, you can use another formula: All the additional spaces have been removed. You will see that the result of the cell only contains the necessary spaces. Next press the button “Enter” on the keyboard.In this formula, the cell A1 is the target cell that contains additional spaces. And then input the following formula into the cell:.Here you can also use Excel functions in Excel to remove spaces. If you need to keep the spaces between words, you can use other methods. You need to pay attention that all the spaces in a cell will be replaces including the spaces between words. When you finish the process, close this window.Now continue the step 4 and step 5 to remove spaces in other cells.Thus, you will find that all the spaces in the cell will be removed. And then click “Replace” in the window.Thus, the cell with spaces will be selected. After that, input a space into the text box of “Find what”.Press the button “Ctrl + F” on the keyboard to open the “Find and Replace” window.In this method, we will show you to use the “Find and Replace” features to remove spaces. Therefore, you can use the methods below to remove spaces. Removing those cells one by one will surely cost a lot of time especially when there are many cells that contain additional spaces. You will find that there are many additional spaces in this cell. The image below shows the contents that we have copied from other sources. And removing those additional spaces will cause a bunch of time and energy. Removing spaces in cells can be annoying because it is difficult to find the exact position. In this article, we will introduce 3 effective methods to remove spaces in cells. When you import contents into Excel from other sources, there will be additional spaces in Excel cells.
