ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   myCell.Row? (https://www.excelbanter.com/excel-programming/388415-mycell-row.html)

Dave Birley

myCell.Row?
 
I was expecting myCell.Row to return the current Row number as an integer
when I loop through a series of rows in a Range. It appears to think that "1"
is all I will ever need to know <g!

What is the correct way to ask for the current Row number?
--
Dave
Temping with Staffmark
in Rock Hill, SC

Vergel Adriano

myCell.Row?
 
Hi Dave,

To get the row number of the current active cell,

ActiveCell.Row

If myCell is a range variable that you use to loop through each cell in a
certain range, then myCell.Row should work.. For example:

Dim myCell as Range
For each myCell in Range("A1:A10")
Debug.Print myCell.Row
Next myCell


--
Hope that helps.

Vergel Adriano


"Dave Birley" wrote:

I was expecting myCell.Row to return the current Row number as an integer
when I loop through a series of rows in a Range. It appears to think that "1"
is all I will ever need to know <g!

What is the correct way to ask for the current Row number?
--
Dave
Temping with Staffmark
in Rock Hill, SC


Ron de Bruin

myCell.Row?
 
Hi Dave

I not see your loop code but you can use this

Dim cell As Range
For Each cell In Range("A1:A10")
MsgBox cell.Row
Next cell



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Dave Birley" wrote in message ...
I was expecting myCell.Row to return the current Row number as an integer
when I loop through a series of rows in a Range. It appears to think that "1"
is all I will ever need to know <g!

What is the correct way to ask for the current Row number?
--
Dave
Temping with Staffmark
in Rock Hill, SC


Dave Birley

myCell.Row?
 
That gave me the clue I was looking for. Don't have it all working yet, but
knowing what to call it, hacking is now an option <g!

Thanks a million.
--
Dave
Temping with Staffmark
in Rock Hill, SC


"Vergel Adriano" wrote:

Hi Dave,

To get the row number of the current active cell,

ActiveCell.Row

If myCell is a range variable that you use to loop through each cell in a
certain range, then myCell.Row should work.. For example:

Dim myCell as Range
For each myCell in Range("A1:A10")
Debug.Print myCell.Row
Next myCell


--
Hope that helps.

Vergel Adriano


"Dave Birley" wrote:

I was expecting myCell.Row to return the current Row number as an integer
when I loop through a series of rows in a Range. It appears to think that "1"
is all I will ever need to know <g!

What is the correct way to ask for the current Row number?
--
Dave
Temping with Staffmark
in Rock Hill, SC



All times are GMT +1. The time now is 09:19 PM.

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