Suggest a code to change the format of column A from text to number

Actually the Column A Contains numbers in text format if I change the format it would become normal. Suggest any VB Code to get it


can you put the sample input

Hi @Gopi_Krishna1

Try this code:

Sub ConvertTextToNumbers()
    Dim cell As Range
    For Each cell In Range("A:A").SpecialCells(xlCellTypeConstants)
        If IsNumeric(cell.Value) Then
            cell.Value = Val(cell.Value)
        End If
    Next cell
End Sub

In the meanwhile an input will help us.


How to use it for multiple column for example Column A,G,L

Hi @Gopi_Krishna1

Provide the input bro. It will help me.

Try this code by the time:

Sub ConvertColumnsToNumbers()
    Dim columnRange As Range
    ' Convert entire columns A, G, and L to number format
    For Each columnRange In Range("A:A,G:G,L:L").Columns
        columnRange.NumberFormat = "General"
        columnRange.Value = columnRange.Value
    Next columnRange
End Sub


Hi @Gopi_Krishna1

I have updated the code. Try that:


Thank you Varunraj it’s working fine

1 Like

You’re welcome @Gopi_Krishna1

Happy Automation!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.