Excel Array里面怎么用offset和resize-ExcelVBA程序开发
1个回答
展开全部
Sub shaixuan()
Dim arr, brr()
Range("F1") = "Name"
Range("G1") = "Price"
arr = Range("A2:B6")
ReDim brr(1 To UBound(arr), 1 To 2)
j = 1
For i = 1 To UBound(arr)
If arr(i, 2) > 400000 Then
brr(j, 1) = arr(i, 1)
brr(j, 2) = arr(i, 2)
j = j + 1
End If
Next i
MsgBox UBound(brr)
Range("F2").Resize(UBound(brr), 2) = brr
End Sub
Dim arr, brr()
Range("F1") = "Name"
Range("G1") = "Price"
arr = Range("A2:B6")
ReDim brr(1 To UBound(arr), 1 To 2)
j = 1
For i = 1 To UBound(arr)
If arr(i, 2) > 400000 Then
brr(j, 1) = arr(i, 1)
brr(j, 2) = arr(i, 2)
j = j + 1
End If
Next i
MsgBox UBound(brr)
Range("F2").Resize(UBound(brr), 2) = brr
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询