In the attached I am copying a range into a variable sized (both # of Records and # of Columns) array. The one common thing with all my possible source ranges in that the 2nd column always contains a Boolean to show if that row/record is to be used in the current pass.
What I would like to do is delete the entire row from the array where that boolean is FALSE. - I figure I need to loop through all columns in the array for that row and deleted the record, but the delete is not working. Is there a better way to do this?
PS: Looping through the Range and determining which rows to add is not going to work, its way too slow.
VB Code:
Sub array_row_delete() Dim MyArray() As Variant Dim x As Integer, y As Integer Dim MyRange As Range Set MyRange = Range("LOB") MyArray = MyRange For x = UBound(MyArray) To 1 Step -1 If Not MyArray(x, 2) Then For y = 1 To MyRange.Columns.Count 'MyArray(x, y).Delete -- this is the piece that does not work Next y End If Next x End Sub




Reply With Quote