I have some data that i pull from a couple of Oracle databases into Excel via a VBA macro. Some of the columns have data (numbers), afaik, stored as text. I need to convert these "wrongly" formatted data to numbers so that i can do calculations on it, however i cant figure out how to do this effectively using VBA. Furthermore only some of the data is stored as text (columns K-Q are formatted incorrectly, see picture below).
Currently im using this loop to convert the data:
Sub convertTextToNumbers(ByVal sColumnHeader As String)
Dim col As Range, c As Range
Dim colIndexNumber As Integer, lastUsedRow As Integer
colIndexNumber = findColumnIndexNumber(sColumnHeader)
lastUsedRow = ActiveSheet.Cells(Rows.Count, colIndexNumber).End(xlUp).Row
Set col = Range(Cells(2, colIndexNumber), Cells(lastUsedRow, colIndexNumber))
For Each c In col
c.Value = c.Value
Next c
End Sub
Is this the most effective way to do it? Can i convert using SQL? The SQL-query im using is simply:
SELECT * FROM table_name
Also converting by choosing another formatting does not work.
Thanks!
Data wrongly formatted is in columns K-Q:

