Hi excel Forum friend's!
I have the following macro:
I want that amount ranges "A2:D" (Multiple range), but only shows me the 1st column ("A"),
When make changes, I get only first value in column listbox, not the 4 columns that I need ..
someone could help me?
Thank you!
Best Regards!!
Dim ListItems As Variant, i As Integer
Dim SourceWB As Workbook
With Me.ListBox2
.Clear ' remove existing entries from the listbox
' turn screen updating off,
' prevent the user from seeing the source workbook being opened
Application.ScreenUpdating = False
' open the source workbook as ReadOnly
Set SourceWB = Workbooks.Open("C:\ICO\ICO_Import_template.xls", _
False, True)
ListItems = SourceWB.Worksheets(1).Range("A2:D").Value
' get the values you want
SourceWB.Close False ' close the source workbook without saving changes
Set SourceWB = Nothing
ListItems = Application.WorksheetFunction.Transpose(ListItems)
' convert values to a vertical array
For i = 1 To UBound(ListItems)
.AddItem ListItems(i) ' populate the listbox
Next i
.ListIndex = -1 ' no items selected, set to 0 to select the first item
Application.ScreenUpdating = True
End With
Bookmarks