美文网首页
VBA之数据清洗

VBA之数据清洗

作者: Valerie549 | 来源:发表于2017-12-06 10:06 被阅读0次

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

    注: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之数据清洗

          本文链接:https://www.haomeiwen.com/subject/lybcixtx.html