How can I delete the first 2 rows in an excel worksheet?Code:
oSelection = DirectCast(csheet.Rows("1:2"), Excel.Range)
oSelection.Delete()
Apprantly the above code does nothing .
Please help
thx
Printable View
How can I delete the first 2 rows in an excel worksheet?Code:
oSelection = DirectCast(csheet.Rows("1:2"), Excel.Range)
oSelection.Delete()
Apprantly the above code does nothing .
Please help
thx
did you try this?
vb Code:
csheet.Rows("1:2").Delete
Further to what ProphetBeal suggested try this
Code:csheet.Rows("1:2").Delete Shift:=xlUp
Code:'Could you do a loop?
For i As Integer = 1 to 2 Step 1
Dim oSelection As myExcel.Range = DirectCast(oSht.Rows(i, ), myExcel.Range)
oSelection.Delete()
Next