Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dev dev is offline
external usenet poster
 
Posts: 66
Default Cell address in a given selection range. Help please!!

The below sub is returning correct cellAddress
==============================
Sub Macro1()
Dim cell As Range
Dim cellAddress As String
For Each cell In Range("B1:C3")
cellAddress = cell.Address(Null, Null, xlA1, Null, Null)
MsgBox (cellAddress)
Next
End Sub

But this is not working - Can't I loop thru the Range like
below?========================================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
Dim cellAddress As String
For Each cell In Range
cellAddress = cell.Address(Null, Null, xlA1, Null, Null)
MsgBox (cellAddress)
Next
End Sub


"Dev" wrote:

I have a method which returns Excel selection Range using get_Address()
method. I am tyring to return all the cells in that selection range.

Ex: If I have selection Range from $A$1:$B$2 (this is my input) then I want
to output
$A$1
$A$2
$B$1
$B$2

Is it possible to achieve this using Excel OM?

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
Returning a cell address in a msgbox, by selection via inputbox Ty FARAZ QURESHI Excel Discussion (Misc queries) 3 April 8th 09 12:57 PM
cell address for first value to appear in a range Dave F[_2_] Excel Discussion (Misc queries) 5 March 19th 08 05:51 PM
cell address rather than range name Angi Bemiss Excel Discussion (Misc queries) 1 December 1st 05 12:46 AM
HOW TO: Get cell address from a range Bob Phillips[_6_] Excel Programming 0 May 4th 04 04:08 PM
HOW TO: Get cell address from a range Juan Pablo González Excel Programming 0 May 4th 04 03:42 PM


All times are GMT +1. The time now is 06:43 PM.

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

About Us

"It's about Microsoft Excel"