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 = xlCalculationAutomatic End 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 ...
随机推荐
- Easyui入门视频教程 第09集---登录完善 图标自定义
目录 ----------------------- Easyui入门视频教程 第09集---登录完善 图标自定义 Easyui入门视频教程 第08集---登录实现 ajax button的使用 ...
- WinPE无法识别NVMe SSD硬盘,如何重装系统
(源自网络出处不详) 抽风,diy一台新机器,下载的win10系统安装时出现如题所示的问题,开始以为是主板的问题设置u盘启动也不行,后来在某个群里有人说是系统版本问题,无奈重新做了启动优盘(用的17年 ...
- JavaScript HTML DOM 入门详解
HTML DOM (文档对象模型) 当网页被加载时,浏览器会创建页面的文档对象模型(Document Object Model). HTML DOM 模型被构造为对象的树. HTML DOM 树 通过 ...
- IPsec ISAKMP(转)
IPsec ISAKMP 2010-08-10 11:47:01 标签:IPsec 职场 休闲 ISAKMP Interne 安全连接和密钥管理协议(ISAKMP)是 IPsec 体系结构中的一种主要 ...
- Git的图形化工具使用教程
虽然感觉并没有什么暖用,但姑且还是写出来留作纪念好了 Git这种分布式版本控制系统最适合的就是单枪匹马搞开发的选手,不需要服务器,下载个git和图形工具,网速快十分钟就能搞定开始愉快的开发工作.我在搭 ...
- Http网络协议
目录结构: contents structure [-] 什么是HTTP协议 Http协议的发展历史 Http的报文结构 客户端请求 服务端响应消息 Content-Type application/ ...
- Linux下实现脚本监测特定进程占用内存情况
Linux系统下,我们可以利用以下命令来获取特定进程的运行情况: cat /proc/$PID/status 其中PID是具体的进程号,这个命令打印出/proc/特定进程/status文件的内容,信息 ...
- CentOS 7.4 使用源码包编译安装MySQL 5.7.20
使用yum安装的MySQL一般版本比较旧,但是运行稳定.如果想要尝试最新的功能或者需要指定特殊的功能的话,就需要手工进行编译安装了. 一.下载安装包 (一).先下载MySQL源码,网址为:https: ...
- 记一次在线安装postgresql-9.4的问题
一.在线安装 apt-get install postgresql-9.4 二.运行状态 systemctl status postgresql 显示运行正常,但是却没有启动默认的5432监听端口 三 ...
- Android 如何添加一个apk使模拟器和真机都编译进去 m
添加一个apk都需要将LOCAL_PACKAGE_NAME的值添加到PRODUCT_PACKAGES才行.而PRODUCT_PACKAGES一般在build/target/product/目录下的文件 ...