码迷,mamicode.com
首页 > 其他好文 > 详细

Excel 用于批量把单元格设置为"文本格式保存的数字"的宏

时间:2015-03-14 18:15:27      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:

首先把所有的数字录入(或者导出为)井号+数字的格式,比如“#3333333323424234234234”,然后运行下面的宏:

Sub Num2Text()
    If Not TypeOf Application.Selection Is Range Then
        MsgBox "You must select cells!"
        Return
    End If
    
    For Each cell In Application.Selection.Cells
        If cell.Text <> "" Then
              cell.FormulaR1C1 = "‘" + Replace(cell.Text, "#", "")
        End If
    Next
End Sub

 

Excel 用于批量把单元格设置为"文本格式保存的数字"的宏

标签:

原文地址:http://www.cnblogs.com/mopno1/p/4337852.html

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