Bonjour letranquille, dhany,
voici un exemple concernant uniquement la colonne A de la feuille active.
il est très facile de modifier ce code pour qu'il agisse sur la colonne de la cellule active.
à vous de voir, au besoin s.v.p. donner plus de détail.
Sub Premier()
t = "Min(IF(NOT(ISBLANK(A:A)),ROW(A:A)))"
p = Evaluate(t)
Cells(p, 1).Activate
End Sub
Sub Dernier()
t = "Max(IF(NOT(ISBLANK(A:A)),ROW(A:A)))"
p = Evaluate(t)
Cells(p, 1).Activate
End Sub
Sub Suivant()
ActiveCell.Offset(1, 0).Activate
End Sub
Sub Précédant()
If ActiveCell.Row <> 1 Then ActiveCell.Offset(-1, 0).Activate
End Sub
autre exemple à partir de la cellule active
exemple pour un déplacement sur la colonne active,
Sub Premier_de_la_Colonne()
If Application.CountA(Columns(ActiveCell.Column)) = 0 Then Exit Sub
FistRow = Cells(1, ActiveCell.Column).End(xlDown).Row
Cells(FistRow, ActiveCell.Column).Activate
End Sub
Sub Dernier_de_la_Colonne()
If Application.CountA(Columns(ActiveCell.Column)) = 0 Then Exit Sub
LastRow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
Cells(LastRow, ActiveCell.Column).Activate
End Sub
Sub Suivant_de_la_Colonne()
ActiveCell.Offset(1, 0).Activate
End Sub
Sub Précédant_de_la_Colonne()
If ActiveCell.Row <> 1 Then ActiveCell.Offset(-1, 0).Activate
End Sub
exemple pour un déplacement sur la ligne active,
Sub Premier_de_la_Ligne()
If Application.CountA(Rows(ActiveCell.Row)) = 0 Then Exit Sub
FistCol = Cells(ActiveCell.Row, 1).End(xlToRight).Column
Cells(ActiveCell.Row, FistCol).Activate
End Sub
Sub Dernier_de_la_Ligne()
If Application.CountA(Rows(ActiveCell.Row)) = 0 Then Exit Sub
LastCol = Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Column
Cells(ActiveCell.Row, LastCol).Activate
End Sub
Sub Suivant_de_la_Ligne()
ActiveCell.Offset(0, 1).Activate
End Sub
Sub Précédant_de_la_Ligne()
If ActiveCell.Column <> 1 Then ActiveCell.Offset(0, -1).Activate
End Sub