View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Deleting every other row

Alan Beban,

I tried to use your script, but when trying to save it, I receive the
error-message: Missing ; before statement. (line 3, file "Code")

Code:
function deleteEvenRows()
{
Set rng = Sheets("A1:A229").[a1]
For i = 1000 to 2 step -2
rng(i).EntireRow.Delete
Next
}


This is not VBA code.., it's .Net!


Function Delete_EvenRows()
Dim rng As Range, n&

Set rng = Sheets("Sheet1").Range("A1:A229")
'Add 1 for odd row count
For n = rng.Rows.Count + 1 to 2 step -2
Rows(n).Delete
Next
End Function

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus