dim i for i=1 to fg.rows-1 if not isnumeric(fg.textmatrix(i, 2)) or _ not isnumeric(fg.textmatrix(i, 3)) then msgbox"2,3列只能输入数字" exit sub end if next i
Private Sub MSHFlexGrid1_LeaveCell() With MSHFlexGrid1 If .Col = 2 Or .Col = 3 Then If Not IsNumeric(.TextMatrix(.Row, .Col)) Then MsgBox "输入必须为数字" End If End If End With
End Sub
private sub mshflexgrid1_change() if mshflexgrid1.col=2 or mshflexgrid1.col=3 then if not isnumeric(.text) then msgbox "2,3列必须输入数字" endif endif end sub
dim i
for i=1 to fg.rows-1
if not isnumeric(fg.textmatrix(i, 2)) or _
not isnumeric(fg.textmatrix(i, 3)) then
msgbox"2,3列只能输入数字"
exit sub
end if
next i
With MSHFlexGrid1
If .Col = 2 Or .Col = 3 Then
If Not IsNumeric(.TextMatrix(.Row, .Col)) Then
MsgBox "输入必须为数字"
End If
End If
End With
End Sub
if mshflexgrid1.col=2 or mshflexgrid1.col=3 then
if not isnumeric(.text) then
msgbox "2,3列必须输入数字"
endif
endif
end sub