码迷,mamicode.com
首页 > 编程语言 > 详细

excel 用VBA将所有单元格内容全部转换为文本

时间:2018-12-06 14:34:13      阅读:695      评论:0      收藏:0      [点我收藏+]

标签:limit   tin   cell   next   double   转换   end   com   column   

Sub 将所有列全部转换为文本()

‘Cells(Rows.Count, 1).End(xlUp).Row 获取第一列最后一个非空单元格的行号
s = Cells(1, Columns.Count).End(xlToLeft).Column ‘获取第一行最后一个非空单元格的列号
For i = 1 To s
    Columns(i).Select
    Selection.TextToColumns Destination:=Cells(1, i), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 2), TrailingMinusNumbers:=True
Next i
End Sub

excel 用VBA将所有单元格内容全部转换为文本

标签:limit   tin   cell   next   double   转换   end   com   column   

原文地址:https://www.cnblogs.com/scai/p/10075927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!