C
Corey
I have populated several Textboxes by a listbox selection, ALL duplicate entries have been removed
from the listbox.
The textbox shows data in the same row as the selected Listbox.value.
But as there may be more than 1 matching value to the listbox(not displayed as duplicates are
removed),
what does a SPIN BUTTON do ?
If i place it next to a Textbox, can i set it to Scroll through the other records ?
I have NEVER used a Spin Button and can onlu assume it could do this.
How do i set it to this, if it can do this?
The code i use to populate the textboxes is here:
Private Sub ListBox2_Click()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("Data").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
..Select
For myrow = 1 To LastCell
If .Cells(myrow, 1) <> "" Then
If .Cells(myrow, 1).Offset(0, 59).Value = ListBox2.Value Then
TextBox1.Value = "A " & Cells(myrow, 1)
TextBox2.Value = Cells(myrow, 43)
TextBox3.Value = Cells(myrow, 19)
TextBox4.Value = Cells(myrow, 20)
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Corey....
from the listbox.
The textbox shows data in the same row as the selected Listbox.value.
But as there may be more than 1 matching value to the listbox(not displayed as duplicates are
removed),
what does a SPIN BUTTON do ?
If i place it next to a Textbox, can i set it to Scroll through the other records ?
I have NEVER used a Spin Button and can onlu assume it could do this.
How do i set it to this, if it can do this?
The code i use to populate the textboxes is here:
Private Sub ListBox2_Click()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("Data").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
..Select
For myrow = 1 To LastCell
If .Cells(myrow, 1) <> "" Then
If .Cells(myrow, 1).Offset(0, 59).Value = ListBox2.Value Then
TextBox1.Value = "A " & Cells(myrow, 1)
TextBox2.Value = Cells(myrow, 43)
TextBox3.Value = Cells(myrow, 19)
TextBox4.Value = Cells(myrow, 20)
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Corey....