以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- replace请教 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=53903) |
-- 作者:hbhb -- 发布时间:2014/7/17 18:53:00 -- replace请教 大师:讨教! For n1 As Integer = sh To mh Dim r As Row = Tables("数据表").AddNew() For m As Integer = sl To ml If IsNumeric(ws.cells(n1,m).value) Then r(m) =val( ws.cells(n1,m).value) End If r(m) = trim(ws.cells(n1,m).value) Next Next 此行改成 r(m) = ws.cells(n1,m).value.replace(" ","") 为何就错误? 这样写也错误 dim a as string = ws.cells(n1,m).value a = a .replace(" ","") r(m) = a
|
-- 作者:don -- 发布时间:2014/7/17 20:56:00 -- dim a as string = ws.cells(n1,m).value if a > "" Then a = a .replace(" ","") End if r(m) = a
|