Going through each item in a sheet

  • Thread starter Thread starter ajitpalsingh200
  • Start date Start date
A

ajitpalsingh200

Guys,,

I have a question here...

Lets say i have a list of item in A1.

for example. A1 to A20 have a list of names..


Just assume that we dont know how many list of items i have there..
How do i set the for loop so that it goes through all the items in A
till the last item.
 
For i = 1 To Range(Range("A1"), Selection.End(xlDown)).Count
MsgBox Cells(i, 1)
Next


- Manges
 
If some of the cells might be empty, try

For i = 1 To range("A" & Rows.Count).End(xlUp).Row
MsgBox Cells(i, 1).address
Next


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top