Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If I want to loop through a column of data, I have usually stated the range (A1:A10). How do I do this without stating the range, but instead have the loop run in a given column until the first empty cell? kind regadrs, Matt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about
For each C in Activesheet.usedRange.Columns("A").cells if C.Value="" Then exit For ' This might be redundant .... doing whatever to C.Value Next C -- Shorter programs last longer! "MJKelly" wrote: If I want to loop through a column of data, I have usually stated the range (A1:A10). How do I do this without stating the range, but instead have the loop run in a given column until the first empty cell? kind regadrs, Matt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you meant find the last row of data:
lRow = Range("A65536").End(xlUp).Row -- Dan On Feb 12, 8:51*am, MJKelly wrote: If I want to loop through a column of data, I have usually stated the range (A1:A10). *How do I do this without stating the range, but instead have the loop run in a given column until the first empty cell? kind regadrs, Matt |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One common way is this
Sub stance() Dim myrnge As Range lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row Set myrange = Range("A1:A" & lastrow) For Each c In myrange 'do somthing Next End Sub Or another to loop down Column A Sub stance1() x = 1 Do myvalue = Range("A" & x).Value 'do something x = x + 1 Loop Until myvalue = "" End Sub Mike "MJKelly" wrote: If I want to loop through a column of data, I have usually stated the range (A1:A10). How do I do this without stating the range, but instead have the loop run in a given column until the first empty cell? kind regadrs, Matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Identifying the every nth document in a column | Excel Discussion (Misc queries) | |||
Identifying Last Column With Text | Excel Discussion (Misc queries) | |||
Identifying the row and column of a table value | Excel Discussion (Misc queries) | |||
Identifying duplicate content in column | Excel Programming |