ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last record in collumn. (https://www.excelbanter.com/excel-programming/339276-last-record-collumn.html)

Tom

Last record in collumn.
 
Hello,

how can I find out by VB last record for example in column A (I need number
of row)? Is there some easy way...

Thanx tom



Norman Jones

Last record in collumn.
 
Hi Tom,

Try:

Dim LastRow As Long

LastRow = Cells(Rows.Count, "A").End(xlUp).Row


---
Regards,
Norman



"Tom" wrote in message
...
Hello,

how can I find out by VB last record for example in column A (I need
number of row)? Is there some easy way...

Thanx tom




Joe Schmoe

Last record in collumn.
 
Here's how I do it. This is from VB.NET, so if using VB6 you'll have to
convert it.


This is chopped out of a real app, so at the top, have:

Imports Excel = Microsoft.Office.Interop.Excel


Then XLApplication is declared in the global variables section: (Lot of
people are confused by where globals go, so if you don't know, see
http://klomdark.servebeer.com:8081/M...px?MsgNum=1586)

Dim XLApplication As New Excel.Application


The actual code to find the last row is:

' Determine last row containing data
With XLApplication
..Range("A1").Select()
..Selection.End(xlDown).Select()
LastRowNum = .ActiveCell.Row()



"Tom" wrote in message
...
Hello,

how can I find out by VB last record for example in column A (I need
number of row)? Is there some easy way...

Thanx tom




Joe Schmoe

Last record in collumn.
 
PS: VB.NET usually doesn't know what 'vbDown' means, so declare it in your
globals section:

Const xlDown = -4121 ' Represents CTRL-DownArrow for determining last cell
with data in current row

"Joe Schmoe" wrote in message
news:t_hTe.20471$tT.387@okepread02...
Here's how I do it. This is from VB.NET, so if using VB6 you'll have to
convert it.


This is chopped out of a real app, so at the top, have:

Imports Excel = Microsoft.Office.Interop.Excel


Then XLApplication is declared in the global variables section: (Lot of
people are confused by where globals go, so if you don't know, see
http://klomdark.servebeer.com:8081/M...px?MsgNum=1586)

Dim XLApplication As New Excel.Application


The actual code to find the last row is:

' Determine last row containing data
With XLApplication
.Range("A1").Select()
.Selection.End(xlDown).Select()
LastRowNum = .ActiveCell.Row()



"Tom" wrote in message
...
Hello,

how can I find out by VB last record for example in column A (I need
number of row)? Is there some easy way...

Thanx tom







All times are GMT +1. The time now is 04:32 AM.

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