Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub Blankrows() col = ActiveCell.Column lastrow = Cells(Rows.Count, col).End(xlUp).Row Hello, I was wondering if the below code could be modified to delete rows? I changed cell.EntireRow.Insert to cell.EntireRow.Delete but it did not work! If IsEmpty(Cells(1, col).Value) Then firstrow = Cells(1, col).End(xlDown).Row Else firstrow = 1 End If Set cell = Cells(lastrow, col) 'If you data does not have a header row, delete the ' + 1 from the line below While cell.Row firstrow + 1 If cell.Value < cell.Offset(-1, 0).Value Then cell.EntireRow.Insert Set cell = cell.Offset(-2, 0) Else Set cell = cell.Offset(-1, 0) End If Wend End Sub Thank you for your help in advance, jfcby |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA code to delete rows | Excel Discussion (Misc queries) | |||
code to delete rows | Excel Discussion (Misc queries) | |||
VB Code to Delete Unused Rows | Excel Programming | |||
Quick n' dirty code to delete rows? | Excel Programming | |||
Code to sort/delete rows | Excel Programming |