VBA List reporting result to specific excel column RRS feed

  • Question

  • Good morning, I am new to VBA and I am working on a paperless checklist for my team. Currently, I have an input in VBA where the employee enters a model type. That input then always goes to the first empty column A in my spreadsheet (And the rest of the checklist populates the subsequent columns).  My challenge is the model data is always entered differently and impossible to sort cleanly. I would like to create a ListBox that has the data in it and then dumps the selection to Column A. I have been able to get the data from the worksheet to the ListBox, I am not sure how to execute the selection to the worksheet. (I assume this needs a command button but I am not sure how to program it). This is a single list. Thanks in Advance.

    Thursday, December 13, 2018 11:41 AM

All replies

  • if this helped please mark as awnser and vote for my post , this helps me and helps the others

    this code dumps the values in fisrt and second columns of the listbox to the calumn a and b i the worksheet

    Private Sub CommandButton1_Click()
    For X = 0 To LIST1.ListCount - 1
       If LIST1.Selected(X) = True Then
          Range("a100000").End(xlUp).Offset(1, 0).Value = LIST1.List(X, 0) ' dumps values of of the first colunm

    Range("b100000").End(xlUp).Offset(1, 0).Value = LIST1.List(X, 1) ' dumps values of of the second colunm 

     End If
     Next X
    End Sub

    Thursday, December 13, 2018 8:51 PM