VBA code to convert text to numbers

  • I have created a excel sheet that gathers up data from other sheets and displays onto to the main sheet in different tabs. The data that is gathered is shown in text and i have tried inserting vba codes but to my dismay none of them work. I am sharing the aforementioned code and would appreciate could help me insert a code in the this code to transform the text to numbers in all the respective sheets in this workbook.



    What this does it basically creates sheets based on a list, but the only issue is the data displayed from the other worksheets is in text and not in numbers.






  • Yes sir. The outcome which is the data( could be name of the employee, salary, working days) all are in text format ( with an exclamation mark over its head, stating - number stored as text.). I don't want the numbers to be stored in text. I am just able to identify why the aforementioned code is doing this.

  • Without knowing exactly which columns are affected you could add some code to try and convert any numbers stored as text eg:


    Code
    1. For Each rCell In ThisWorkbook.Sheets(SourceSheetName).UsedRange
    2.    rCell.Value = rCell.Value
    3. Next rCell


    This would need to be added after data is copied from the recordset.