Convert string to int if string is a number

前端 未结 6 1105
余生分开走
余生分开走 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:44

    To put it on one line:

    currentLoad = IIf(IsNumeric(oXLSheet2.Cells(4, 6).Value), CInt(oXLSheet2.Cells(4, 6).Value), 0)
    

提交回复
热议问题