excel如何去掉换行符号_去掉文本中所有换行符

excel如何去掉换行符号_去掉文本中所有换行符excel中添加换行符::alt+enter去掉excel中的换行符有三种方法:注:解决过程中翻阅其他博客,看到如下方式:1、看到有的说全选后“取消自动换行”,保存后,再打开,依然存在换行符

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

excel 中添加换行符:

  :alt+enter

去掉excel中的换行符有三种方法:

注:解决过程中翻阅其他博客,看到如下方式:

1、看到有的说全选后“取消自动换行”,保存后,再打开,依然存在换行符

2、ctrl+H,然后按住alt输入“10”或者“0010”,然后替换,测试无效,可能我操作不对

解决办法:

M1:

  1. 直接查找替换,选中你要替换的位置or全选(ctrl+a)
  2. 然后按 ctrl+h,打开替换界面
  3. 在替换内容窗口,输入ctrl+j,看起来是空的,但是你能看到一个点闪烁。
  4. 在替换为窗口,输入你要替换的内容,什么也不输入表示删掉
  5. 然后按照需要选择全部替换,或者替换

M2 and M3:不翻译了,看起来有点麻烦

原文链接:https://www.ablebits.com/office-addins-blog/2013/12/03/remove-carriage-returns-excel/

Delete line breaks using Excel formulas

Pros: you can use a formula chain / nested formulas for complex cell text processing. For example, it is possible to remove carriage returns and then eliminate excess leading and trailing spaces and those between words.

Or you may need to delete carriage returns to use your text as an argument of another function without changing the original cells. For example, if you want to be able to use the result as an argument of the function =lookup ().

Cons: you’ll need to create a helper column and follow many extra steps.

  1. Add the helper column to the end of your data. You can name it “1 line”.
  2. In the first cell of the helper column (C2), enter the formula to remove / replace line breaks. Here you can see several helpful formulas for different occasions:
    • Handle both Windows and UNIX carriage return/ line feeds combinations.
      =SUBSTITUTE(SUBSTITUTE(B2,CHAR(13),""),CHAR(10),"")
    • The next formula will help you replace line break with any other symbol (comma+space). In this case lines will not join and extra spaces will not appear. 
      =TRIM(SUBSTITUTE(SUBSTITUTE(B2,CHAR(13),""),CHAR(10),", ")
    • If you want to remove all nonprintable characters from text, including line breaks:
      =CLEAN(B2)

    Excel formula to delete carriage returns from cells

  3. Copy the formula across the other cells in the column.
  4. Optionally, you can replace the original column with the one where the line breaks were removed:
    • Select all cells in column C and press Ctrl + C to copy the data to clipboard.
    • Now pick the cell B2 and press the Shift + F10 shortcut. Then just press V.
    • Remove the helper column.

VBA macro to get rid of line breaks

Pros: Being created once, can be reused in any workbook.

Cons: you need to have the basic knowledge of VBA.

The VBA macro from the example below deletes carriage returns from all cells in the currently opened worksheet (active worksheet).

 
Sub
RemoveCarriageReturns()
    
Dim
MyRange
As
Range
    
Application.ScreenUpdating =
False
    
Application.Calculation = xlCalculationManual
 
    
For
Each
MyRange
In
ActiveSheet.UsedRange
        
If
0 < InStr(MyRange, Chr(10))
Then
            
MyRange = Replace(MyRange, Chr(10),
""
)
        
End
If
    
Next
 
    
Application.ScreenUpdating =
True
    
Application.Calculation = xlCalculationAutomatic
End
Sub

If you don’t know VBA really well, see How to insert and run VBA code in Excel

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/167854.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Unity安装 ILRuntime插件

    Unity安装 ILRuntime插件unity2019.4.2f1c1在packagemanager里面找不到ILRuntime插件解决办法:编辑项目下Packages的manifest.json文件,添加如下代码贴出来方便大家复制自己需要的部分{“scopedRegistries”:[{“name”:”ILRuntime”,”url”:”https://registry.npmjs.org”,”scopes”:[…

    2022年6月27日
    78
  • java中int转long

    java中int转longpackagepid69;publicclassSolution{ publicstaticintmySqrt(intx){ intresult=0; if(x==0||x==1){ returnx; }else{ for(inti=0;i<=x/2;i++){ inta=i*i; //防止溢出,务必注意右边需…

    2022年6月6日
    34
  • spring boot整合shiro_Spring框架介绍及使用

    spring boot整合shiro_Spring框架介绍及使用目录1、Shiro简介1.1、Shiro是什么?1.2、有哪些功能?1.3、Shiro架构(外部)2、快速入门(QuickStartShiro)2.1、项目结构2.2、导入shiro依赖,这是我的pom所有依赖。(pom.xml)2.3、相关配置文件(1)log4j.properties——官网(2)shiro.ini——官网(3)启动类Quickstart——官网3、SpringBoot集成Shiro框架3.1SpringBoot整合Shir…

    2022年9月8日
    0
  • python用pycharm还是vscode_pycharm自带python吗

    python用pycharm还是vscode_pycharm自带python吗python的两大IDE开发利器,pycharm和vscode,二者各有优劣,本文主要谈谈二者的调试对比。pycharmvsvscode简单对比pycharm优点:python开发利器,专为python设计内置功能丰富,比如可以在IDE中直接查看sql数据库,前提是有插件:DBBROWER查看类、函数定义方便,只需简单通过ctrl+鼠标左键即可完成可直接定义项目工作目录,在fil…

    2022年8月28日
    1
  • hdu 1215 七夕节

    hdu 1215 七夕节

    2022年2月6日
    51
  • nacicat15 激活码_在线激活

    (nacicat15 激活码)这是一篇idea技术相关文章,由全栈君为大家提供,主要知识点是关于2021JetBrains全家桶永久激活码的内容https://javaforall.net/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~S32PGH0SQB-eyJsaWNlb…

    2022年3月26日
    42

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号