4,374 questions
How I Delete Rows of an Excel Spreadsheet Using Open XML in VB.Net
Anonymous
I have an Excel Spreadsheet that I am using as a template file. I want to start by deleting all but the first row of the first worksheet. I tried the following code. It should work, but it immediately exits the For loop right after the Row.Remove() statement is executed. This seems like a bug. How do I accomplish this?
The For Loop
For Each Row As Row In SheetData.Elements(Of Row)
If Int(Row.RowIndex) > 1 Then
Row.Remove()
End If
Next
The full code block.
Microsoft 365 and Office Development Other
Sign in to answer