1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Dim curZone As Range, x As Range, md As Range, ri As Range, _
nbArea As Integer, l As Integer
Set md = Union(Range("a1"), Range("b2"), Range("c3"), Range("d4"), Range("e5"), Range("f6:f10"))
Set curZone = Range("A1:F10")
'simplement avec for each
For Each x In md.Areas
If x.Row > 5 Then
For l = 1 To x.Rows.Count
Set ri = curZone.Range(Cells(6, 1), Cells(x.Row + l - 1, x.Column - 1)) 'juste la ligne
ri.Select
MsgBox "La selection actuelle a pour adresse " & ri.Address, vbInformation
'ou
Set ri = curZone.Range(Cells(x.Row, 1), Cells(x.Row, x.Column)) 'au choix
ri.Select
MsgBox "La selection actuelle a pour adresse " & ri.Address, vbInformation
Next
Else
Set ri = curZone.Range(Cells(x.Row + 1, 1), Cells(x.Row + 1, x.Column)) 'juste la ligne
ri.Select
MsgBox "La selection actuelle a pour adresse " & ri.Address, vbInformation
End If
Next |
Partager