Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This appears to delete all the rows and not just the alternate ones as desired?
"Frank Kabel" wrote: Hi try the following macro: Sub delete_rows() Dim lastrow As Long Dim row_index As Long Application.ScreenUpdating = False lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For row_index = lastrow To 1 Step -1 If row_index mod 2 =1 then Rows(row_index).delete End If Next Application.ScreenUpdating = True End Sub -----Original Message----- I have a worksheet where I want to delete alternate rows. i.e. rows 1,3,5,7,9.......... because they contain no data. Currently I am holding the control key and selecting every other row, then using the delete row toolbar button. However I have many worksheets to do. I thought I'd create a macro to automatically hilight alternate rows and then just use the delete row button. I did create that macro but when using it, instead of hilighting the alternate rows from where my cursor is inserted it just hilights the same rows as when the macro was created (i.e. the wrong rows). How can I set something up that allows me to hilight alternate rows from where I place my cursor. . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select each alternate row in a worksheet | Excel Discussion (Misc queries) | |||
Color alternate rows when after hiding selected rows | Excel Worksheet Functions | |||
reformating data- how to delete alternate blank rows quickly | Excel Discussion (Misc queries) | |||
quickly select data to produce charts | Charts and Charting in Excel | |||
Select alternate rows to copy | Excel Discussion (Misc queries) |