HELP NEED MACRO TO DELETE DATA IN SPECIFIED ROWS


Posted by EDDIE G on October 12, 2001 12:38 PM

I need a macro that will start at row 7 and delete just the data (not delete the row itself) out of every other row (9,11,13, etc.)all the way to row 999. Currently I am using a simple repetitive row.select.clearcontents which is too long and takes too long to run. Can someone help?



Posted by Ramon Wilson on October 12, 2001 2:32 PM


Sub Delete_Alternate_Rows()
Dim rng As Range
Application.ScreenUpdating = False
Columns("A:A").Insert
Set rng = Range("A7:A999")
With rng
.FormulaR1C1 = "=IF(MOD(ROW(),2)=0,1,"""")"
.SpecialCells(xlCellTypeFormulas, 2).EntireRow.ClearContents
End With
Columns("A:A").Delete
Application.ScreenUpdating = True
End Sub