I am trying to use a listbox selection to lift only a small segment of the data out of the source of a listbox. I am trying to use the cells argument to pint point the starting spot and then resizing the selection to pull data into another part of the workbook. Unfortunately the resize argument doesn't seem to be pairing well with the cells argument. How can I go about achieving my task? Code is as follows:
The selected_list is a function I use to figure out the selection that is active in the listbox. I have tried to assign the cell to a range and then resizing but it also does not work.
VBA Code:
Private Sub TruckOneAdd_Click()
Dim iRow As Long
Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets("UserFormData")
'code to update the value to the respective fields
Me.TextBox1.Value = Selected_List + 1
iRow = Me.TextBox1.Value
If Selected_List = 0 Then
MsgBox "No selection.", vbOKOnly + vbInformation, "Order Select"
Exit Sub
End If
Sh.Cells(iRow, 2).Resize(0, 4).Copy ' this does not work
The selected_list is a function I use to figure out the selection that is active in the listbox. I have tried to assign the cell to a range and then resizing but it also does not work.