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
|
Function DecalerCellulesVisibles(CelluleDepart As Range, Optional Lignes As Long = 0, Optional Colonnes As Long = 0) As Range
Dim i As Long
Dim Cellule As Range
On Error GoTo Fin
Set Cellule = CelluleDepart
Do While i < Abs(Lignes)
If Lignes > 0 Then Set Cellule = Cellule(2) Else Set Cellule = Cellule(0)
If Not Cellule.EntireRow.Hidden Then i = i + 1
Loop
i = 0
Do While i < Abs(Colonnes)
If Colonnes > 0 Then Set Cellule = Cellule(1, 2) Else Set Cellule = Cellule(1, 0)
If Not Cellule.EntireColumn.Hidden Then i = i + 1
Loop
Fin:
If Err = 0 Then
Set DecalerCellulesVisibles = Cellule
Else
Set DecalerCellulesVisibles = Nothing
End If
End Function |