ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   row number and column number of cell (https://www.excelbanter.com/excel-programming/374903-row-number-column-number-cell.html)

Pierre Laporte

row number and column number of cell
 
I need to know in visual basic what is the row number and column number of
the cell that is used with the highest row and column number.

__________________________________________________ ________________ Pierre
Laporte



Don Guillett

row number and column number of cell
 
I don't quite understand the question but

myrow=activecell.row
mycol=activecell.column


--
Don Guillett
SalesAid Software

"Pierre Laporte" wrote in message
...
I need to know in visual basic what is the row number and column number of
the cell that is used with the highest row and column number.

__________________________________________________ ________________ Pierre
Laporte




Charles Chickering

row number and column number of cell
 
Here is a function that will return the last cell as a range, you could
either break the code apart and get what you need or just use the Range.Row
and Range.Column properties.

Function FindLastCell() As Range
Dim LastColumn As Integer
Dim LastRow As Long
Dim LastCell As Range
If WorksheetFunction.CountA(Cells) 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
Set FindLastCell = Cells(LastRow, LastColumn)
Else
Set FindLastCell = Range("A1")
End If
End Function

'to use this function call it like this:
Dim lCell As Range
Set lCell = FindLastCell
Row = lCell.Row
Column = lCell.Column

--
Charles Chickering

"A good example is twice the value of good advice."


"Pierre Laporte" wrote:

I need to know in visual basic what is the row number and column number of
the cell that is used with the highest row and column number.

__________________________________________________ ________________ Pierre
Laporte




Pierre Laporte

row number and column number of cell
 
i dont want the activecell but the cell with the highest row number that has
a value

"Don Guillett" wrote in message
...
I don't quite understand the question but

myrow=activecell.row
mycol=activecell.column


--
Don Guillett
SalesAid Software

"Pierre Laporte" wrote in message
...
I need to know in visual basic what is the row number and column number of
the cell that is used with the highest row and column number.

__________________________________________________ ________________ Pierre
Laporte






Don Guillett

row number and column number of cell
 
myrow=cells(rows.count,"a").end(xlup).row


--
Don Guillett
SalesAid Software

"Pierre Laporte" wrote in message
...
i dont want the activecell but the cell with the highest row number that
has a value

"Don Guillett" wrote in message
...
I don't quite understand the question but

myrow=activecell.row
mycol=activecell.column


--
Don Guillett
SalesAid Software

"Pierre Laporte" wrote in message
...
I need to know in visual basic what is the row number and column number
of the cell that is used with the highest row and column number.

__________________________________________________ ________________
Pierre Laporte








Don Guillett

row number and column number of cell
 
or
cells(1,1).end(xldown).row

--
Don Guillett
SalesAid Software

"Pierre Laporte" wrote in message
...
i dont want the activecell but the cell with the highest row number that
has a value

"Don Guillett" wrote in message
...
I don't quite understand the question but

myrow=activecell.row
mycol=activecell.column


--
Don Guillett
SalesAid Software

"Pierre Laporte" wrote in message
...
I need to know in visual basic what is the row number and column number
of the cell that is used with the highest row and column number.

__________________________________________________ ________________
Pierre Laporte









All times are GMT +1. The time now is 11:24 AM.

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