Hi all,
Lost again.
I have two List Boxes, LstBx_ColorsAvailable and LstBx_ColorsSelected. The user adds values from ColorsAvailable to ColorsSelected. The Add Flower button then finds the first available column and set the values in
Row 1 = TxtBx_LatinName
Row 2 = TxtBx_Common Name
Rows 3 to Row n = all values in LstBx_ColorsSelected where n is the count of all values in the list box
The first two operation for LatinName and CommonName are working but I'm lost on how to add the values from the list box to the sheet.
Private Sub CmdBtn_AddFlower_Click()
'
'Source: kev_ https://www.excelforum.com/excel-programming-vba-macros/1217246-vba-code-for-updating-data-from-user-form-to-worksheet.html
'
Dim lc As Long
Dim lbCount As Integer
Dim i As Long
lbCount = LstBx_ColorsSelected.ListCount
With Sheets("Flowers Available")
'Find next column
lc = .Cells(1, Columns.Count).End(xlToLeft).Column + 1
'place Latin Name and Common Name values in cells
.Cells(1, lc).Value = TxtBx_LatinName
.Cells(2, lc).Value = TxtBx_CommonName
'Pull all values from TxtBx_ColorsSelected and dump them
'to the vertical array below (2, lc)
Dim i
For i = 0 To LstBx_ColorsSelected.ListCount
LstBx_ColorsSelected.Selected(i) = ChkAll
Next i
'Clear text boxes
TxtBx_LatinName.Text = ""
TxtBx_CommonName.Text = ""
TxtBx_LatinName.SetFocus
End Sub
My initial post for this project can be found at:
Thank you for the help.
Bookmarks