VBA, Userforms: selecting different Controls by name (for a loop)

Eker Selim 1 Reputation point
2021-05-27T08:19:51.443+00:00

Hello Everyone,

I just started to learn VBA for a project and i have a userform where i have multiple sliders that give me values that i want to use to build a 2D Array with For loops.

My Array is 5 by 5 and it is "Symmetric" (1 as diagonal, Thus I only need one side for the values).

I obtain the matrix values after converting values obtained from sliders in the GUI, which i named Sld1v2 (for row 1, col 2), Sld1v3 (for row1, col3) etccc.

I am thus looking for a way to call the right Slider (by its custom name) in the for loops but i cannot figure how i can do it, can you help me ?

Following you can see the Excel Version of what i want to code and my attempt of a script.
I hope my request is clear :)

100183-capture1.png

100185-capture2.png

Developer technologies | Visual Basic for Applications
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Eker Selim 1 Reputation point
    2021-05-27T10:12:30.797+00:00

    Update: i used this line of code and it doesnt appear as red anymore. However i now get: type doesn't match. I have no idea what could be the potential issue :C

    100245-capture3.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.