excel 添加换行符,去除换行符:
excel 中添加换行符:
:alt+enter
去掉excel中的换行符有三种方法:
注:解决过程中翻阅其他博客,看到如下方式:
1、看到有的说全选后“取消自动换行”,保存后,再打开,依然存在换行符
2、ctrl+H,然后按住alt输入“10”或者“0010”,然后替换,测试无效,可能我操作不对
解决办法:
M1:
- 直接查找替换,选中你要替换的位置or全选(ctrl+a)
- 然后按 ctrl+h,打开替换界面
- 在替换内容窗口,输入ctrl+j,看起来是空的,但是你能看到一个点闪烁。
- 在替换为窗口,输入你要替换的内容,什么也不输入表示删掉
- 然后按照需要选择全部替换,或者替换
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.
- Add the helper column to the end of your data. You can name it "1 line".
- 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)

- Handle both Windows and UNIX carriage return/ line feeds combinations.
- Copy the formula across the other cells in the column.
- 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 = xlCalculationAutomaticEnd Sub |
If you don't know VBA really well, see How to insert and run VBA code in Excel
excel 添加换行符,去除换行符:的更多相关文章
- (转载)SQL去除回车符,换行符,空格和水平制表符
http://www.cnblogs.com/insus/p/4815336.html MS SQL去除回车符,换行符,空格和水平制表符,参考下面语句,一般情况是SQL接受富文本或是textarea的 ...
- SQL去除回车符,换行符,空格和水平制表符
MS SQL去除回车符,换行符,空格和水平制表符,参考下面语句,一般情况是SQL接受富文本或是textarea的内容.在数据库接收到这些数据之后,还是对其做一些处理. ),),),''),' ','' ...
- sqlite 去除换行符
去除换行符操作: update t_config_list ;
- python使用platform模块获取系统环境并去除换行符
近来在porting一个网站,企图拿到这个网站的数据来做分析.为了支持多系统环境的正常运行.需要知道当前系统环境的是什么OS? 1.python内置platform库.可以很方便得到当前系统环境时什么 ...
- php去除换行符的方法小结(PHP_EOL变量的使用)
本来在unix世界换行就用/n来代替,但是windows为了体现他的不同,就用/r/n,更有意思的是在mac中用/r.因此unix系列用 /n,windows系列用 /r/n,mac用 /r,这样就用 ...
- SQL的查询结果复制到Excel 带标题Head 有换行符导致换行错乱 的解决方案
将SQL查询到的结果保存为excel有很多方法,其中最简单的就是直接复制粘贴了 1.带Head的复制粘贴 1)先左击红色区域实现选择所有数据 2)随后右击选择Copy with Headers 再粘 ...
- MySQL去除表里数据回车符,换行符,空格和水平制表符
MySQL去除表里数据回车符,换行符,空格和水平制表符 最近导数据的时候发现表里有好多回车符,换行符,水平制表符,MySQL的trim函数没办法去掉回车和换行,只能去掉多余的空格,可以用MySQL的r ...
- sqlserver数据库 去除字段中空格,换行符,回车符(使用replace语句)
SQL中可以使用Replace函数来对某个字段里的某些字符进行替换操作,语法如下: 语法 REPLACE ( original-string, search-string, replace-strin ...
- sql中去掉换行符和回车符
sql 中,char(13),char(10)或nchar(13),nchar(10)可表示SQL中的回车换行符,但是会以空格的形式显示.replace(replace(字段名,char(10), ' ...
- CCLabelTTF 如何支持换行符和换行
参考自http://www.cocos2d-x.org/wiki/How_does_CCLabelTTF_support_line_breaks_and_wrapping 环境: cocos2d-x ...
随机推荐
- 不可不知的mysql 常用技巧总结
不可不知的mysql 常用技巧总结 mysql常用命令 mysqld --启动mysql数据库 show databases; -- 查看数据库 use database; -- 选择数据库 show ...
- 一个正则表达式,只含有汉字、数字、字母、下划线,下划线位置不限【Z】
1.一个正则表达式,只含有汉字.数字.字母.下划线不能以下划线开头和结尾: ^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]+$ 其中: ^ 与字符串开始的地方匹配 ( ...
- (原)CosFace/AM-Softmax及其mxnet代码
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/8525241.html 论文: CosFace: Large Margin Cosine Loss fo ...
- 什么样的路由器有类似改hosts的功能
2011-7-22 23:06:45 如题 就是像电脑上改hosts那样把某个域名强制解析到指定IP上 TT,DD和openwrt有没有这样的功能? ------------------------- ...
- 关于CASE WHEN的多条件汇总问题
https://bbs.csdn.net/topics/392217817?page=1 问题: --创建测试表 IF EXISTS (SELECT * FROM sys.objects WHERE ...
- keras的训练引擎:train_array.py和train_generator.py
keras的Model支持两种模式的训练: 直接传入数组,最终会调用train_array.py中的fit_loop()函数 直接传入生成器,最终会调用train_generator.py中的fit_ ...
- linux下网络配置小节[from 老男孩的linux运维笔记]
对于linux高手看似简单的网络配置问题,也许要说出所以然来也并不轻松,因此仍然有太多的初学者徘徊在门外就不奇怪了, 这里,老男孩老师花了一些时间总结了这个文档小结,也还不够完善,欢迎大家补充,交流. ...
- Android之listview运用(美团美食列表)
首先我们将listview简单实现,有图形,有文字:效果如图 之前我们完成了一个较为简单的listview视图列表,但是生活中我们往往碰到的 是更为复杂列表,有图像有评分标准,不如我们来试一试手,做一 ...
- maven最全教程
Maven 教程 1.Maven概述 Maven 是什么? Maven 是一个项目管理和整合工具.Maven 为开发者提供了一套完整的构建生命周期框架.开发团队几乎不用花多少时间就能够自动完成工程的基 ...
- 测试Js权限
'12222' 测试一下 刚兴趣的可以参考: http://www.cnblogs.com/littledu/archive/2011/05/08/2040298.html http://www.cn ...