autigers
Board Regular
- Joined
- Oct 9, 2005
- Messages
- 139
After searching through and trying the various codes that were in this forum ... I have come up short ... (Shutup)
I have a listbox on userform that populates data from the code below
what I am trying to achieve is that when I select a line in the listbox, I wish to have the 11 textboxes that are under the listbox populate with the data that relates to the list box for editing purposes ....
As always your assistance is greatly appreciated ....
I have a listbox on userform that populates data from the code below
what I am trying to achieve is that when I select a line in the listbox, I wish to have the 11 textboxes that are under the listbox populate with the data that relates to the list box for editing purposes ....
As always your assistance is greatly appreciated ....
Code:
Private Sub UserForm_Initialize()
Dim a, i As Long, ii As Integer, n As Long
Dim ListAry()
With Sheets("Waves").Range("A2").CurrentRegion
a = .Resize(, 13).Value
End With
For i = 2 To UBound(a, 1)
If IsEmpty(a(i, 13)) Then
n = n + 1
ReDim Preserve ListAry(1 To 13, 1 To n)
For ii = LBound(a, 2) To UBound(a, 2)
If ii = 2 Then
If Not IsEmpty(a(i, ii)) Then
ListAry(ii, n) = CStr(Format(a(i, ii), "hh:mm AM/PM"))
End If
Else
ListAry(ii, n) = a(i, ii)
End If
Next
ListAry(13, n) = i
End If
Next
Erase a
If n = 0 Then Me.ListBox1.Clear: Exit Sub
With Me.ListBox1
.ColumnCount = 12
.ColumnWidths = "0;52;54;54;54;54;54;54;54;54;54;40;10"
.Column = ListAry
End With
End Sub