View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to loop through cells in a column?

Dim myRng as range
dim myCell as range

with worksheets("somesheetnamehere")
set myrng = .range("L2", .cells(.rows.count,"L").end(xlup))
end with

for each mycell in myrng.cells
if len(mycell.value) 255 then
msgbox mycell.address(0,0)
'stop looking???
exit for
end if
next mycell

Judy Ward wrote:

My goal is to find a row of data that has more than 255 characters in column L.

This works for one cell:
x = Len(Range("L2"))

Can someone help me with looping through cells L2, L3, L4 and so on--keeping
in mind that I need to use the Len function--so that I can perform an action
when I find a row that meets the criteria.

Thank you,
Judy


--

Dave Peterson