View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default 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.