Forum Discussion

Szymeqpl_'s avatar
Szymeqpl_
Copper Contributor
Oct 11, 2023
Solved

Converting text to numbers.

Good morning,

While getting data to excel, numbers were stored as text on multiple worksheets. Is there a way to convert text to numbers in all worksheets?

 

  • Szymeqpl_ 

    A macro:

    Sub ConvertTextToNumbers()
        Dim wsh As Worksheet
        Application.ScreenUpdating = False
        For Each wsh In Worksheets
            With wsh.UsedRange
                .NumberFormat = "General"
                .Value = .Value
            End With
        Next wsh
        Application.ScreenUpdating = True
    End Sub
  • Szymeqpl_ 

    A macro:

    Sub ConvertTextToNumbers()
        Dim wsh As Worksheet
        Application.ScreenUpdating = False
        For Each wsh In Worksheets
            With wsh.UsedRange
                .NumberFormat = "General"
                .Value = .Value
            End With
        Next wsh
        Application.ScreenUpdating = True
    End Sub

Resources