Convert string to int if string is a number

前端 未结 6 1136
余生分开走
余生分开走 2020-12-05 06:08

I need to convert a string, obtained from excel, in VBA to an interger. To do so I\'m using CInt() which works well. However there is a chance that the string

6条回答
  •  清歌不尽
    2020-12-05 06:37

    Just use Val():

    currentLoad = Int(Val([f4]))
    

    Now currentLoad has a integer value, zero if [f4] is not numeric.

提交回复
热议问题