VBA之数据清洗

说明:将文本数据转为数值格式

注:D4,I4,J4为所需要清洗的列


Sub 数据清洗()

'

' 数据清洗 Macro

' 文本数据转为数值

'

' 快捷键: Ctrl+r

'

Range(Selection, Selection.End(xlDown)).Select

Selection.TextToColumns Destination:=Range("D4"), DataType:=xlDelimited, _

TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _

Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _

:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True

Range("I4").Select

Range(Selection, Selection.End(xlDown)).Select

Selection.TextToColumns Destination:=Range("I4"), DataType:=xlDelimited, _

TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _

Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _

:=Array(1, 1), TrailingMinusNumbers:=True

Range("J4").Select

Range(Selection, Selection.End(xlDown)).Select

Selection.TextToColumns Destination:=Range("J4"), DataType:=xlDelimited, _

TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _

Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _

:=Array(1, 1), TrailingMinusNumbers:=True

End Sub

你可能感兴趣的:(VBA之数据清洗)