ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrieving the last cell in a column and using this row number in a counter (https://www.excelbanter.com/excel-programming/384216-retrieving-last-cell-column-using-row-number-counter.html)

Luc

Retrieving the last cell in a column and using this row number in a counter
 
I want the row number of the last cell in a column (column A) to be the 'To'
value in the counter below

For cnt = 1 To 500
.......

So i do not want to put 500 there, but the row of the last cell that
contains a value.(there are empty rows!)
Lets say the last cell would be A5412

What do i have to put there in place of the '500'



Thanx,

Luc

--------------------------------------------------------------------------------
Mijn Postvak In wordt beschermd door SPAMfighter
323 spam-mails zijn er tot op heden geblokkeerd.
Download de gratis SPAMfighter vandaag nog!



Jim Thomlinson

Retrieving the last cell in a column and using this row number in
 
dim lngLastRow as Long

lngLastRow = cells(rows.count, "A").End(xlUp).Row

for cnt = 1 to lngLastRow
--
HTH...

Jim Thomlinson


"Luc" wrote:

I want the row number of the last cell in a column (column A) to be the 'To'
value in the counter below

For cnt = 1 To 500
.......

So i do not want to put 500 there, but the row of the last cell that
contains a value.(there are empty rows!)
Lets say the last cell would be A5412

What do i have to put there in place of the '500'



Thanx,

Luc

--------------------------------------------------------------------------------
Mijn Postvak In wordt beschermd door SPAMfighter
323 spam-mails zijn er tot op heden geblokkeerd.
Download de gratis SPAMfighter vandaag nog!




Luc

Retrieving the last cell in a column and using this row number in
 
Thanxxxxx,

That did the job !!

Greetzzzzz,

Luc



"Jim Thomlinson" wrote in message
...
dim lngLastRow as Long

lngLastRow = cells(rows.count, "A").End(xlUp).Row

for cnt = 1 to lngLastRow
--
HTH...

Jim Thomlinson


"Luc" wrote:

I want the row number of the last cell in a column (column A) to be the
'To'
value in the counter below

For cnt = 1 To 500
.......

So i do not want to put 500 there, but the row of the last cell that
contains a value.(there are empty rows!)
Lets say the last cell would be A5412

What do i have to put there in place of the '500'



Thanx,

Luc

--------------------------------------------------------------------------------
Mijn Postvak In wordt beschermd door SPAMfighter
323 spam-mails zijn er tot op heden geblokkeerd.
Download de gratis SPAMfighter vandaag nog!




--------------------------------------------------------------------------------
Mijn Postvak In wordt beschermd door SPAMfighter
323 spam-mails zijn er tot op heden geblokkeerd.
Download de gratis SPAMfighter vandaag nog!




All times are GMT +1. The time now is 03:58 PM.

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