Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Cell access within Selection.Areas

Dim a As Range
Dim cell As Range

For Each a In Selection.Areas
For Each cell In a
Debug.Print cell.Address
Next 'cell
Next 'a

You should add error code in case Selection is not a range.

NickHK

"maxcad" wrote in message
...
I am trying to sequentially access cells with multple selection areas. I
know that Selection.Areas(1) is supposed to be the first group of selected
cells, but how do I access them? Selection.Areas(1).Cells(1,1) doesn't

work.

Any insights would be appreciated.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Cell access within Selection.Areas

Private Sub CommandButton1_Click()
Dim area As Range

For Each area In Range("rngAreas").Areas
With area
.Cells(1, 1).Value = "First"
.Cells(.Rows.Count, .Columns.Count).Value = "Last"
End With
Next

End Sub

NickHK

"maxcad" wrote in message
...
NickHK,

I see how this addesses each cell sequentially. How can I specify certain
cells within the selection area?

maxcad

"NickHK" wrote:

Dim a As Range
Dim cell As Range

For Each a In Selection.Areas
For Each cell In a
Debug.Print cell.Address
Next 'cell
Next 'a

You should add error code in case Selection is not a range.

NickHK

"maxcad" wrote in message
...
I am trying to sequentially access cells with multple selection areas.

I
know that Selection.Areas(1) is supposed to be the first group of

selected
cells, but how do I access them? Selection.Areas(1).Cells(1,1)

doesn't
work.

Any insights would be appreciated.






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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
How to access the text selection when user is editing cell Buergermeister Excel Programming 5 May 5th 06 02:47 PM
access specific areas of a protected worksheet shital shah Excel Programming 2 September 5th 05 03:53 PM
How to subtract many cell areas (between sheets) Imbecill[_2_] Excel Programming 4 June 2nd 04 02:28 PM
Selection and Areas Jac Tremblay Excel Programming 7 April 25th 04 06:46 PM


All times are GMT +1. The time now is 11:02 AM.

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"