Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"