learningthings
New Member
- Joined
- Oct 29, 2021
- Messages
- 35
- Office Version
- 365
- Platform
- Windows
I populated my listbox with this code:
Now when I click the save button I want the selected row in the listbox to have the words "picked up" printed
But this code does nothing. What should I do?
VBA Code:
Dim rng As Range
Dim MyArray
Set ws = Sheets("Sell")
'~~> Set you relevant range here
Set rng = ws.Range("A1:O" & ws.Range("A" & ws.Rows.Count).End(xlUp).Row)
With .lstpickuporder
.Clear
.ColumnHeads = False
.ColumnCount = rng.Columns.Count
'~~> create a one based 2-dim datafield array
MyArray = rng
'~~> fill listbox with array values
.List = MyArray
'~~> Set the widths of the column here. Ex: For 5 Columns
'~~> Change as Applicable
.ColumnWidths = "90;60;70;60;50;70;80;70;70;70;70;70;70;70;70"
.TopIndex = 0
.ListIndex = .ListCount - 1
End With
Now when I click the save button I want the selected row in the listbox to have the words "picked up" printed
Code:
Dim rw As Long
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("sell")
Dim lRw As Long
rw = Me.lstpickuporder.ListIndex + 2
With sh
.Cells(rw, 14) = "Picked Up"
.Cells(rw, 15) = Now()
End With