ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   finalrow question (https://www.excelbanter.com/excel-programming/413903-finalrow-question.html)

joemeshuggah

finalrow question
 
i am using the following bit of code for a macro i am putting together:

Sheets("KPI").Select
Range("A2").Select
FinalRow = Range("A65536").End(xlUp).Row
Range("A2" & FinalRow).Select

at present (varies daily), column a on this sheet has data in cells
a2:a132...when i execute this portion of code, cell A2132 is selected instead
of a2 through the last row. i tried clearing contents and deleting all cells
from a133:iv65536, executed again, and still the same result. what would
cause this problem to occur?

Mike H

finalrow question
 
Try

Sheets("KPI").Select
FinalRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A2:A" & FinalRow).Select

Mike

"joemeshuggah" wrote:

i am using the following bit of code for a macro i am putting together:

Sheets("KPI").Select
Range("A2").Select
FinalRow = Range("A65536").End(xlUp).Row
Range("A2" & FinalRow).Select

at present (varies daily), column a on this sheet has data in cells
a2:a132...when i execute this portion of code, cell A2132 is selected instead
of a2 through the last row. i tried clearing contents and deleting all cells
from a133:iv65536, executed again, and still the same result. what would
cause this problem to occur?


joemeshuggah

finalrow question
 
Worked perfectly!!! Thank you so much!!!

"Mike H" wrote:

Try

Sheets("KPI").Select
FinalRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A2:A" & FinalRow).Select

Mike

"joemeshuggah" wrote:

i am using the following bit of code for a macro i am putting together:

Sheets("KPI").Select
Range("A2").Select
FinalRow = Range("A65536").End(xlUp).Row
Range("A2" & FinalRow).Select

at present (varies daily), column a on this sheet has data in cells
a2:a132...when i execute this portion of code, cell A2132 is selected instead
of a2 through the last row. i tried clearing contents and deleting all cells
from a133:iv65536, executed again, and still the same result. what would
cause this problem to occur?



All times are GMT +1. The time now is 02:18 AM.

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