ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Function to extract and return the first and last cell from addres (https://www.excelbanter.com/excel-programming/304753-re-function-extract-return-first-last-cell-addres.html)

Ron de Bruin

Function to extract and return the first and last cell from addres
 
Hi quartz

Try this

Sub test()
With Range("a10:g145") ' or With Selection
MsgBox .Cells(1).Address
MsgBox .Cells(.Cells.count).Address
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"quartz" wrote in message ...
Hello. I need a function that will return the top left cell address and the bottom right cell address from a range address.

For example:

Given: $AB$256:$AF$300 Return: Top left cell: AB256; Bot Right Cell: AF300

Given: A12:G53 Return: Top left cell: A12; Bottom Right Cell: G53

Can one function return both or do I need two separate functions?
Thanks much in advance.





All times are GMT +1. The time now is 09:37 PM.

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