Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Loop
Im trying to loop (at least thats what I think I do) this code below. I want
it check the last row of data to check if the cell is empty and if so, delete the entire row. It only works the once then the sub ends. How would I loop this so that it checks until all empty cells have been deleted. Range("u7").End(xlDown).Select ActiveCell.Offset(0, -16).Select If ActiveCell.Value = "" Then ActiveCell.EntireRow.Select ActiveCell.EntireRow.Delete Else End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Loop
See if this site can help you to organize the code.
http://www.rondebruin.nl/delete.htm#Loop "Woodi2" wrote: Im trying to loop (at least thats what I think I do) this code below. I want it check the last row of data to check if the cell is empty and if so, delete the entire row. It only works the once then the sub ends. How would I loop this so that it checks until all empty cells have been deleted. Range("u7").End(xlDown).Select ActiveCell.Offset(0, -16).Select If ActiveCell.Value = "" Then ActiveCell.EntireRow.Select ActiveCell.EntireRow.Delete Else End If |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Loop
Hi
I think this is what you need: Sub ccc() Set StartCell = Range("u7") LastRow = StartCell.End(xlDown).Row TargetCol = "E" For r = LastRow To StartCell.Row Step -1 If Range(TargetCol & r).Value = "" Then Rows(r).Delete End If Next End Sub Regards, Per "Woodi2" skrev i meddelelsen ... Im trying to loop (at least thats what I think I do) this code below. I want it check the last row of data to check if the cell is empty and if so, delete the entire row. It only works the once then the sub ends. How would I loop this so that it checks until all empty cells have been deleted. Range("u7").End(xlDown).Select ActiveCell.Offset(0, -16).Select If ActiveCell.Value = "" Then ActiveCell.EntireRow.Select ActiveCell.EntireRow.Delete Else End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
returning back to loop check condition without completing the loop | Excel Programming | |||
Loop to Filter, Name Sheets. If Blank, Exit Loop | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
(Complex) Loop within loop to create worksheets | Excel Programming | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming |