View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Nick Hodge[_2_] Nick Hodge[_2_] is offline
external usenet poster
 
Posts: 185
Default How to loop through cells in a column?

Judy

You can loop through a collection using a For...Next loop like so

Sub Find Over255()
Dim myCell as Range
For Each myCell in Range("L1:L100")
If Len(myCell.Value)255 Then
'Do what you want here
End If
Next myCell
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.excelusergroup.org
web: www.nickhodge.co.uk





"Judy Ward" wrote in message
...
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