Who can help me, I have the following code that I found somewhere that I don't remember:
Code:
Private Sub UserForm_Initialize()
Dim rng As Range
Set rng = Range("B4:D8")
With ComboBox1
.ColumnCount = 2
.ColumnWidths = "50;50"
' load 1st, 2nd columns of range into combobox
.List = Application.Index(rng, Evaluate("ROW(1:" & rng.Rows.Count & ")"), Array(1, 3))
End With
End Sub
In "sheet1" I have three columns of data in the range from B4 to D8 (the headers in row 3). In a combobox the data of columns B and D appears.This is a multicolumn combobox with non-continuous columns (that are not next to each other). It works perfectly and is adapted to what I wanted. Unfortunately I don't understand how the line
".List = Application.Index(rng, Evaluate("ROW(1:" & rng.Rows.Count & ")"), Array(1, 3))"
works and I can't stay So.
I know that we are making an output list from an input list and I understand that evaluate with row is returning the index of the rows that have data in the range, from the first row to the fifth, and that with array we determine the columns which will take the combobox (or so I thought I understood).
But why can't we use an array to determine the rows as well?
I tried to do it and it didn't work for me.
If someone is kind enough to tell me what data is returning evaluate (which is supposed to be used to occupy excel formulas in vba) with row, I would greatly appreciate it.
I hope everything is understood. I'm using google translator.
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg. 9k3ShckGnhv9k89LsaigoO
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg. 9k-vfnj3ivI9k8B2r_uRa2
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg. 9h5lFRmix1R9h78GftO_iE
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg. 9h740K6COOA9h77HSGDH4A
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg. 9h740K6COOA9h76fafzcEJ
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg. 9h740K6COOA9h759YIjlaG
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg. 9h740K6COOA9h74pjGcbEq
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg
https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgzJJUDVv2Mb6YGkPYh4AaABAg. 9h5uPRbWIZl9h7165DZdjg
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
Bookmarks