Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
raj raj is offline
external usenet poster
 
Posts: 32
Default Last cell within an address

Hello,

Does anyone know the easiest way (i.e. most
efficient/fewest code lines/fastest code, etc.) to select
the S.E. corner or bottom right cell address from a single
area range address stored in a variable?

For example, if my variable contains: strRange = "$2:$4"
My function would return the string: "$IV$4"

OR,

If my variable contains: strRange = "$BA457:FJ1057"
My function would return the string: "$FJ$1057"

Your example code would be most appreciated. Thanks much
for your assistance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Last cell within an address

Raj,

Here ya go!


Using a range parameter (better):

Function LastCellFromRange(rng As Range)
LastCellFromRange = rng.Resize(1, 1).Offset(rng.Rows.Count - 1,
rng.Columns.Count - 1).Address
End Function

Using a string parameter:

Function LastCellFromString(sRng As String)
LastCellFromString = Range(sRng).Resize(1,
1).Offset(Range(sRng).Rows.Count - 1, Range(sRng).Columns.Count - 1).Address
End Function


--
Charles
www.officezealot.com


"raj" wrote in message
...
Hello,

Does anyone know the easiest way (i.e. most
efficient/fewest code lines/fastest code, etc.) to select
the S.E. corner or bottom right cell address from a single
area range address stored in a variable?

For example, if my variable contains: strRange = "$2:$4"
My function would return the string: "$IV$4"

OR,

If my variable contains: strRange = "$BA457:FJ1057"
My function would return the string: "$FJ$1057"

Your example code would be most appreciated. Thanks much
for your assistance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Last cell within an address

How about...

Sub ReturnLastCellAddress()
Dim strRange As Range
Set strRange = Range("$2:$4")
MsgBox strRange(strRange.Count).Address
End Sub


--
Regards,
Rocky McKinley


"raj" wrote in message
...
Hello,

Does anyone know the easiest way (i.e. most
efficient/fewest code lines/fastest code, etc.) to select
the S.E. corner or bottom right cell address from a single
area range address stored in a variable?

For example, if my variable contains: strRange = "$2:$4"
My function would return the string: "$IV$4"

OR,

If my variable contains: strRange = "$BA457:FJ1057"
My function would return the string: "$FJ$1057"

Your example code would be most appreciated. Thanks much
for your assistance.



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
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),QuoteNotes, sarah Excel Worksheet Functions 2 February 17th 09 02:59 PM
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),Range ... ? sarah Excel Worksheet Functions 0 February 17th 09 02:06 PM
Return cell address of a cell based on contents of cell. Danny Excel Worksheet Functions 4 November 15th 08 03:11 AM
How to create table of cell names with the name's cell address WildwoodEngr Excel Discussion (Misc queries) 1 October 26th 06 02:52 PM
How make hyperlink refer to cell content rather than cell address. Omunene Excel Discussion (Misc queries) 3 March 2nd 06 01:07 AM


All times are GMT +1. The time now is 08:05 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"