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 28 29 30 31 32 33 34 35 36
| '"Plage" est la plage de cellules à transposer
'"Base" est la 1ere cellule dans l'angle supérieur gauche pour
'la transposition de la plage
'"Act" contient la reference de la cellule contenant cette fonction
Public Function InversePlage(Plage As Range, Base As Range, Act As Range)
Dim xB As Double, xA As Double
Dim yB As Byte, yA As Byte
Dim i As Integer, j As Integer
xB = Base.Row
yB = Base.Column
xA = Act.Row
yA = Act.Column
If Intersect(Range(Cells(xB, yB), Cells(xB + Plage.Rows.Count, _
yB + Plage.Columns.Count)), Act) Is Nothing Then
InversePlage = ""
Exit Function
End If
i = Plage.Rows.Count - (xA - xB)
If i = 0 Then
InversePlage = ""
Exit Function
End If
j = Plage.Columns.Count - (yA - yB)
If j = 0 Then
InversePlage = ""
Exit Function
End If
InversePlage = Plage.Cells(i, j).Value
End Function |
Partager