maybe try this

 Sub ConvertTextToNumber()
With Range("B5:B14") <---- change this to suit your range in column D
.NumberFormat = "General"
.Value = .Value
 End With
End Sub
If you run this before doing anything else, it should convert your range to numbers.