请教老师:
向excel表中填入数字,第2行和第4行如果判断为是数字,就加上千位分隔符,出现负数无法被确认为是数字,请求解决!
代码如下:
Dim sss1 As Double
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r +3, c).Value = dt.rows(r)(c)
sheet(r +3, c).Style = style5 '#########此条代码加入后,日期栏无法正常显示
If Sheet(r +3, c).Value = "0"
Sheet(r +3, c).Value = Nothing
End If
If c = 1 Or c =3 Then
If Char.IsNumber(Sheet(r +3, c).Value) '判断是否是数字
sss1 = CDbl(Sheet(r +3, c).Value)
Sheet(r +3, c).Value = format(sss1,"#,###.00")
sheet(r +3, c).Style = style4
End If
End If
Next
Next