我想从数组中复制一组值,而不是满足条件(例如值<70)到下一列
'Qo reported (bd) - array
For i = 0 To cap
array_Qorep(i, 0) = Range("A" & i + 1)
Cells(i + 1, 3) = array_Qorep(i, 0) 'copy array in the next column
If Cells(i + 1, 1).Value = Empty Then Exit For 'more values below, stop in blank
Next
问题是我不知道如何在数组中应用我想要的条件然后复制到下一列,有没有办法从数组中删除不符合条件的值然后复制它们?
这里是解决方案由于某种原因它之前没有工作但现在它确实:) ,并感谢Absinthe
'Qo reported (bd)
For i = 0 To cap
array_Qorep(i, 0) = Range("A" & i + 1)
If Cells(i + 1, 1).Value = Empty Then Exit For
If array_Qorep(i, 0) > Cells(3, 4) Then
Cells(i + 1, 3) = array_Qorep(i, 0)
End If
Next
答案 0 :(得分:0)
这样做吗?首先构建你的数组:
arrPos = 1
For x = 0 to myArray.length
if myArray(x,0) < 70 then
cells(arrPos, 1) = myArray(x, 0)
arrPos = arrPos + 1
End If
next x