【问题标题】:How to remove each line break character within a field in vba如何删除vba中字段中的每个换行符
【发布时间】:2018-03-25 14:42:23
【问题描述】:

告诉我如何解决这个问题?对不起我的英语不好。我来自乌克兰。 有一个 CSV 格式的文本文件,以 unix 格式的字符串结尾。

List of fields:

1) ID;
2) Surname;
3) First name;
4) Middle name;
5) Date of birth;
6) Type and number of the document proving the identity;
7) Address of residence;
8) Registration address.

There are no tabs inside the field, but there is an unshielded newline character `("\ n")`. 

第一个字段 (ID) 具有数字类型,并且保证不包含换行符。 如何在 vba 上编写将删除每个换行符的脚本 在田野里?

为了让你更好地理解我的帮助请求,这里的例子(in xls)格式错误 wrong 并纠正 correct.

【问题讨论】:

标签: vba csv


【解决方案1】:

试试这个宏;

Sub Broken_line_remover()
' Removing carriage returns from text strings

Dim ws As Worksheet
Set ws = ActiveSheet
ws.Cells.Replace what:=Chr(10), replacement:=" "
Set ws = Nothing
End Sub

【讨论】:

    猜你喜欢
    • 2015-10-31
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    • 2014-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多