1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Option Explicit
Public Lig As Long
Private Sub SpinButton1_Change()
Lig = Lig + Me.SpinButton1 - 10
Do
If ActiveSheet.Range("G" & Lig) <> 0 Then Exit Do
Lig = IIf(Me.SpinButton1 = 10, Lig = Lig + 1, Lig + Me.SpinButton1 - 10)
Loop Until Lig >= ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row Or Lig <= 7
If Lig <= 7 Then
Lig = 7
ElseIf Lig > ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row Then
Lig = Lig - 1
End If
Me.TextBox1 = Range("B" & Lig)
Application.EnableEvents = False
Me.SpinButton1 = 10
Application.EnableEvents = True
End Sub
Private Sub UserForm_Initialize()
Lig = 7
Me.SpinButton1 = 10
End Sub |
Partager