• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to use listbox?

GeraldDLT

Member
Hi all,

Please help me filling a listbox with our schedule that will automatically update everyday.
It has 3 columns btw.

Thanks,
Gerald
 

Attachments

  • Book1.xlsm
    57.1 KB · Views: 8
One way
Code:
Private Sub UserForm_Initialize()
    Dim myCol As Long, x
    With Sheets("schedule").[b2].CurrentRegion
        myCol = Application.Match(CLng(Date), .Rows(1), 0)
        If IsError(myCol) Then Exit Sub
        x = Filter(.Parent.Evaluate("transpose(if((row(" & .Address & ")>2)*(" & .Columns(myCol).Address & _
                "<>""OFF""),row(1:" & .Rows.Count & "),char(2)))"), Chr(2), 0)
        If UBound(x) > -1 Then
            Me.ListBox1.List = Application.Index(.Value, Application.Transpose(x), Array(1, 2, myCol))
        End If
    End With
End Sub
 

Attachments

  • Book1 with code.xlsm
    59.8 KB · Views: 8
One way
Code:
Private Sub UserForm_Initialize()
    Dim myCol As Long, x
    With Sheets("schedule").[b2].CurrentRegion
        myCol = Application.Match(CLng(Date), .Rows(1), 0)
        If IsError(myCol) Then Exit Sub
        x = Filter(.Parent.Evaluate("transpose(if((row(" & .Address & ")>2)*(" & .Columns(myCol).Address & _
                "<>""OFF""),row(1:" & .Rows.Count & "),char(2)))"), Chr(2), 0)
        If UBound(x) > -1 Then
            Me.ListBox1.List = Application.Index(.Value, Application.Transpose(x), Array(1, 2, myCol))
        End If
    End With
End Sub


You're genius brother!
 
Back
Top