我正在编写比较用户窗体中的两个日期和数组中的列的代码。
如果它介于两者之间,则将整行设置在另一个数组中。
Dim vD1 As Variant
Dim vD2 As Variant
vD1 = UserForm1.TextBox1.Value
vD2 = UserForm1.TextBox2.Value
If vD1 = Empty Then
vD1 = #1/1/2010#
End If
If vD2 = Empty Then
vD2 = #1/1/2100#
End If
vD1 = Format(vD1, "General Number")
vD2 = Format(vD2, "General Number")
For i = 1 To 100
If myArray5(i, 1) >= vD1 Then
If myArray5(i, 1) <= vD2 Then
For j = 1 To 8
myArray6(i, j) = myArray5(i, j)
Next j
End If
End If
Next i
For i = 1 To 100
If myArray5(i, 1) <= vD1 Then
If myArray5(i, 1) >= vD2 Then
For j = 1 To 8
myArray6(i, j) = Empty
Next j
End If
End If
Next i