I am trying to get the selected items from a listbox which is on the mainsheet and get those selected items inside a Listbox which is on a user form.
This is the Code,
Sub Viewselectshow()
For lItem = 0 To Sheets("Main").Ent_ListBox.ListCount - 1
If Sheets("Main").Ent_ListBox.Selected(lItem) = True Then
ItemReq = Sheets("Main").Ent_ListBox.Selected(lItem)
ViewSelectedEntitlements.ViewEntitlementListbox.AddItem ItemReq
End If
Next
ViewSelectedEntitlements.Show
End Sub
It works, But it shows a value of -1 in the Listbox on the Userform which is clearly not the Selected item. The Selected Item is a "CaraPhone". Any Suggestions, Kindly share your thoughts.
因此,您需要使用ItemReq = Sheets("Main").Ent_ListBox.List(lItem)
而不是ItemReq = Sheets("Main").Ent_ListBox.Selected(lItem)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.