2017-10-13 6 views
1

この問題の解決方法を教えてください。私の英語のために申し訳ありません。私はウクライナ出身です。 文字列の終わりがunix形式のCSV形式のテキストファイルがあります。vbaのフィールド内の各改行文字を削除する方法

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

+0

置換を使用できます。空白行の文字を探します。参照:https://stackoverflow.com/questions/8550240/access-vba-how-to-replace-parts-of-a-string-with-otherother-string –

+0

[文字列の改行を削除する方法]の可能な複製(https://stackoverflow.com/questions/10024402/how-to-remove-line-break-in-string) – Asdrubal

答えて

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 
関連する問題