In my VBA macro, I need to totally remove some rows. The following code deletes all the values in the rows - leaving blank, empty rows - but does not actually delete the rows. How do I do that?
For i = UBound(DataArray) To LBound(DataArray) 1 Step -1
Rows(DataArray(i, 1)).Delete
Next i
TIA.
CodePudding user response:
This seems to be deleting rows (below screenshot of before & after running the code);
Sub code()
Dim DataArray(6 To 10) As String
For i = UBound(DataArray) To LBound(DataArray) 1 Step -1
Rows(i).Delete
Next i
End Sub
Before running the above code;
After Running the code; ID number 6,7,8,9 are deleted...