View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default Find Range Borders (Cell Addresses) In VBA

welcome!
pls click Yes if it helped

On 15 Maj, 10:44, FARAZ QURESHI
wrote:
Thanx Jarek!

XClent!

Never had the idea of using Cells().Address!



"Jarek Kujawa" wrote:
use this macro:


Sub cus()
Dim min_row As Integer
Dim rows_count As Integer
Dim min_col As Integer
Dim cols_count As Integer
Dim Borders As String


min_row = Selection.Row
rows_count = Selection.Rows.Count
min_col = Selection.Column
cols_count = Selection.Columns.Count
Borders = Cells(min_row, min_col).Address & "," & Cells(min_row,
min_col + cols_count - 1).Address & "," & Cells(min_row + rows_count -
1, min_col).Address & "," & Cells(min_row + rows_count - 1, min_col +
cols_count - 1).Address


MsgBox "The active borders are " & Borders


End Sub


On 15 Maj, 08:52, FARAZ QURESHI
wrote:
I have a selected range, say X5:AC99. What piece of code would return a msgbox:
"The active range borders a
$X$5, $AC$5, $X$99 & $AC$99"- Ukryj cytowany tekst -


- Pokaż cytowany tekst -