ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Going through each item in a sheet (https://www.excelbanter.com/excel-programming/315969-going-through-each-item-sheet.html)

ajitpalsingh200[_8_]

Going through each item in a sheet
 

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.

--
ajitpalsingh20
-----------------------------------------------------------------------
ajitpalsingh200's Profile: http://www.excelforum.com/member.php...fo&userid=1615
View this thread: http://www.excelforum.com/showthread.php?threadid=27586


mangesh_yadav[_167_]

Going through each item in a sheet
 

For i = 1 To Range(Range("A1"), Selection.End(xlDown)).Count
MsgBox Cells(i, 1)
Next


- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27586


Bob Phillips[_6_]

Going through each item in a sheet
 
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)


"mangesh_yadav" wrote in
message ...

For i = 1 To Range(Range("A1"), Selection.End(xlDown)).Count
MsgBox Cells(i, 1)
Next


- Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile:

http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=275863





All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com