Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum column A:? where ? is a number in a cell somewhere Murray[_2_] Excel Worksheet Functions 2 June 26th 08 05:57 PM
Random cell/number and dont repeat selected cell/number Hector PR Excel Discussion (Misc queries) 0 October 16th 06 05:02 PM
how i write a number on a column A and see that number on letters. Mauricio Excel Worksheet Functions 2 March 12th 06 09:29 PM
how do you add a new number to each cell in a column JCE New Users to Excel 2 February 15th 06 03:03 PM
Auto number w/ different letter-number combos in same column Colleen B Excel Worksheet Functions 2 February 23rd 05 02:41 PM


All times are GMT +1. The time now is 11:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"