Deleting Rows based upon Row number

I am having trouble figuring out how to delete rows based upon the index or row number.

I thought that I might try to get the row number and put it into a variable to use as my column numbers however, I can’t figure out how to list the column numbers veritically.

For example if my row numbers are 7, 8 12, 13, I can only get hte to list in an text file as


How can i get htem to list 7, 8, 12, 13

Test.xaml (15.0 KB)

Delete rows from what? From a datatable?

no from an excel file.


First of all, it is very dangerous to delete rows like that. Look, if you have 20 rows and you want to delete 7, 8, 12, 13 in for each row, if you delete 7th the 8th become 7th, 12th become 11th and 13th become 12th and so on. I prefer to delete rows in Excel/DT is descending order, in that case when You first remove 13th row other rows are at correct positions.

I attach corrected file, please check if it is what You want.

Test.xaml (19.6 KB)

I am getting the following error. How do i initialize a collection


we do reverse / Descending ordering the index series, so the indexes are not confused

Deletion an Excel row have a look on the Inser/Delete Rows Activity


I am getting the error message


How to i initialize the collection

please do not repeat posts, show us the details instead

Init the list
myList = new List(Of Int32)

Add items:

My bad, I did not init list, before you add any element do init like Peter said: list = new List(Of Int32)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.