#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 66
Default Loop

I have a macro which loops and performs the functions. However it goes
around and does not stop. How do I tell it Do until there is no data in cell
or it reaches the end of data in the column.


Thanks
Cristina
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Loop

Let's say we are processing data in oclumn C and we want to stop at either
the first empty cell in column C or the last value in column C

Sub Crissy()
Dim C As Range, r As Range
Set C = Range("C:C")
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For i = 1 To LastRow
If IsEmpty(Cells(i, "C").Value) Then Exit Sub
MsgBox Cells(i, "C").Value
Next
End Sub

So we both determine the last row and also look for the first empty as well.
--
Gary''s Student - gsnu201001


"Christina" wrote:

I have a macro which loops and performs the functions. However it goes
around and does not stop. How do I tell it Do until there is no data in cell
or it reaches the end of data in the column.


Thanks
Cristina

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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
if loop sippe Excel Discussion (Misc queries) 2 November 10th 08 09:45 AM
Do Loop Vs For Each jlclyde Excel Discussion (Misc queries) 3 September 29th 08 08:48 PM
DO LOOP in VBA Brettjg Excel Discussion (Misc queries) 5 April 24th 07 12:42 AM
getting out of a if loop rk0909 Excel Discussion (Misc queries) 3 April 11th 06 03:55 PM


All times are GMT +1. The time now is 12:44 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"