Convert numbers to text-formatted numbers

2019-08-04 13:54发布

How can I convert all number value in cell in column to text format number?

I tried =TEXT(A2,"A2") but it doesn't help me.

2条回答
时光不老,我们不散
2楼-- · 2019-08-04 14:34

Here is VBA since that was in you tags.

Loop through the rows changing the columns you want.

    Dim ws1 As Excel.Worksheet
    Dim strValue As String

    Set ws1 = ActiveWorkbook.Sheets("Sheet3")

    Dim lRow As Long
    lRow = 1

    ws1.Activate
    'Loop through and record what is in the columns
    Do While lRow <= ws1.UsedRange.Rows.count

        'Make sure we have a value to read into our string
        If ws1.Range("F" & lRow).Value <> "" Then
            'Get the number as a string
            strValue = str(Trim(ws1.Range("F" & lRow).Value))
            'Format the cell as text
            ws1.Range("F" & lRow).NumberFormat = "@"
            'Write the string value back to the cell
            ws1.Range("F" & lRow).Value = strValue
        End If
        lRow = lRow + 1
    Loop
查看更多
小情绪 Triste *
3楼-- · 2019-08-04 14:42

Without VBA: select your column, Text to Columns, Delimited, Tab, Column data format Text.

查看更多
登录 后发表回答