yves_sater
New Member
- Joined
- Jul 29, 2010
- Messages
- 15
i would like to do smthg like this:
Option Explicit
Private Sub ListBox1_Change()
Dim I As Integer
For I = 1 To 4
Me.Controls("TextBox" & I).Value = Range("A" & ListBox1.ListIndex + 2).Offset(, I)
Next I
End Sub
Private Sub SpinButton1_Change()
If ListBox1.ListIndex <> ListBox1.ListCount - 1 Then
ListBox1.ListIndex = SpinButton1.Value
Else
ListBox1.ListIndex = 0
SpinButton1.Value = 0
End If
End Sub
Private Sub UserForm_Initialize()
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
ListBox1.RowSource = "A2:A" & LastRow
SpinButton1.Min = 0
SpinButton1.Max = LastRow
End Sub
by using only one spin button i can scroll down and up all vlaues of the textboxes and comboboxes that i have in my userform....can anyone help me plz
Option Explicit
Private Sub ListBox1_Change()
Dim I As Integer
For I = 1 To 4
Me.Controls("TextBox" & I).Value = Range("A" & ListBox1.ListIndex + 2).Offset(, I)
Next I
End Sub
Private Sub SpinButton1_Change()
If ListBox1.ListIndex <> ListBox1.ListCount - 1 Then
ListBox1.ListIndex = SpinButton1.Value
Else
ListBox1.ListIndex = 0
SpinButton1.Value = 0
End If
End Sub
Private Sub UserForm_Initialize()
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
ListBox1.RowSource = "A2:A" & LastRow
SpinButton1.Min = 0
SpinButton1.Max = LastRow
End Sub
by using only one spin button i can scroll down and up all vlaues of the textboxes and comboboxes that i have in my userform....can anyone help me plz