How should I make a ListBox in Excel into a Date Sorce?

Testested 61 Reputation points
2022-10-23T22:19:58.35+00:00

How should I make a List Box in Excel into a Date Sorce?

Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
{count} votes

Answer accepted by question author
  1. Oskar Shon 49,311 Reputation points Volunteer Moderator
    2022-12-04T18:50:25.767+00:00

    aaa long time... and easy answer using code write up... hmm
    ok learn

     Dim x&, y&  
     For x = 1 To ListBox1.ColumnCount  
           For y = 1 To ListBox1.ListCount  
                If x = 1 Then Cells(y, 2) = ListBox1.List(y - 1, x - 1)  
                If x = 2 Then Cells(y, 1) = ListBox1.List(y - 1, x - 1)  
           Next  
     Next  
    

    X variable I using for columns, then switch that is a easy job to do. Its done.

    So exercise for you now - you must read about that and make it.
    If you had a more than 2 columns in control, learn about back loop without condition, to switch it opposite count. Do you?


6 additional answers

Sort by: Most helpful
  1. Testested 61 Reputation points
    2022-10-30T00:35:37.013+00:00

    I am very new with VBA.. I would like to use a List Box for a data source. Is this possible?


  2. Testested 61 Reputation points
    2022-10-30T00:38:04.827+00:00
    0 comments No comments

  3. Oskar Shon 49,311 Reputation points Volunteer Moderator
    2022-11-08T18:04:26.38+00:00

    I guess.
    you can see list box using in worksheet as object ActiveX

    258367-xl-listbox-multiselect.png

    or you can use the same in VBA Form as control

    258239-listbox-1.png

    0 comments No comments

  4. Testested 61 Reputation points
    2022-11-24T14:54:27.823+00:00

    Hi, @Oskar Shon

    Please see snipping below. I am trying to push data from a Listbox to a spreadsheet.
    263930-screenshot-2022-11-24-084717.png

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.