仮の配列を作り、編集してaryに入れるようにしたいのですが これだと、全て空欄になってしまいます Dim i As Long, j As Long, cnt As Long, cnt2 As Long i = Cells(Rows.Count, 1).End(xlUp).Row '仮の配列 ReDim Kariary(i, 30) As Variant Kariary = Range("A2:AD" & i).Value '最終的に代入する配列 ReDim ary(i - 1, 30) As Variant
For cnt = 1 To i - 1 If Not Kariary(cnt, 1) = 66 Or _ Kariary(cnt, 6) = 1000 Or _ Kariary(cnt, 28) = "" Then
j = UBound(ary) + 1 If j < i - 1 Then For cnt2 = 1 To 30 ReDim Preserve ary(j, 30) As Variant ary(j, cnt2) = Kariary(cnt, cnt2) Next cnt2 End If End If Next cnt 'シートを一旦クリア Cells.Clear Range("A2:AD" & i) = ary