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.
|