7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command2_Click()
Dim i, j, k, num As Integer 'i,j,k是中间变量,num是确定矩阵的大小(具体几*几)
num = UBound(a) * UBound(a, 2)
For i = 0 To UBound(a) - 1 '从1维开始
For j = 0 To UBound(a, 2) - 1 '第2维度判断
If a(i, j) = "" Then k = k + 1 '记录空的个数
Next
Next
If k = num Then '判断是不是矩阵都是空值
msgbox"错误:未计算,请重新计算":exit sub
else
'
将h写入另一个表格
Private Declare Function VarPtr Lib "msvbvm60.dll" (ByRef Ptr() As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Function IsEmptyArray(Arr() As Double) As Boolean
Dim Result As Long
CopyMemory Result, ByVal VarPtr(Arr), 4
IsEmptyArray = CBool(Result = 0)
End Function
Private Sub Command1_Click()
Dim f() As String
If CheckNull(f) Then MsgBox "空" Else MsgBox "非空"
ReDim f(1)
If CheckNull(f) Then MsgBox "空" Else MsgBox "非空"
ReDim f(1, 1)
If CheckNull(f) Then MsgBox "空" Else MsgBox "非空"
Erase f
If CheckNull(f) Then MsgBox "空" Else MsgBox "非空"
End Sub
'检测是否空数组
Private Function CheckNull(aryIn As Variant) As Boolean
On Error GoTo errhandle
Dim a As Long
a = LBound(aryIn)
CheckNull = False
Exit Function
errhandle:
CheckNull = True
End Function