Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing Excel Userform Control Name Value From String (VBA)

Tags:

excel

vba

Typically when referencing a userform control value in Excel VBA I would enter something to the effect of radiobutton.value

However, I want to be able to use a string as the name of the user control. The idea behind this would be to dynamically be able to generate the control name and reference a value from it.

For example I may want to reference ctradiobutton.value one time, and etradiobutton.value the next, these controls already exist on the form, I just want to reference a different name of the control from a string created on the current iteration.

like image 276
Thomas Avatar asked Jun 06 '14 14:06

Thomas


1 Answers

Like this (where Me is the UserForm)

Me.Controls("TextBox1").Value
like image 94
SWa Avatar answered Oct 22 '22 07:10

SWa