Kelinky_Sama
New Member
- Joined
- Aug 27, 2016
- Messages
- 6
So, this question is rather similar to the one I've asked before.
Let's say that I have a variable called "Nickname" within a UserForm that I would like to have the same value as that of another variable whose name can be built up from different captions in the UserForm. This other variable is identified by "Catalogue.Names(1)" (located in a different module) and has a value of "Melvin". Imagine that I have in the UserForm a label with a caption of "(1)" simply called "Label1". I would thus like to do something along the following:
However, this would just make the value of Nickname "Catalogue.Names(1)". I tried using CStr() to see if it would help, but it just returns the same value as before.
Is there any way around this? I know I've made it sound as though I could just specify "Melvin" or the other variable directly, but the value of Label1 changes based on circumstance, and I'd like the code to be accustomed to that.
I am currently running on Windows 8.1 with Microsoft Excel 2016 32-bit.
Let's say that I have a variable called "Nickname" within a UserForm that I would like to have the same value as that of another variable whose name can be built up from different captions in the UserForm. This other variable is identified by "Catalogue.Names(1)" (located in a different module) and has a value of "Melvin". Imagine that I have in the UserForm a label with a caption of "(1)" simply called "Label1". I would thus like to do something along the following:
HTML:
Dim Nickname As String
Catalogue.Names(1) = "Melvin"
Nickname = "Catalogue.Names" & Me.Label1.Caption
However, this would just make the value of Nickname "Catalogue.Names(1)". I tried using CStr() to see if it would help, but it just returns the same value as before.
Is there any way around this? I know I've made it sound as though I could just specify "Melvin" or the other variable directly, but the value of Label1 changes based on circumstance, and I'd like the code to be accustomed to that.
I am currently running on Windows 8.1 with Microsoft Excel 2016 32-bit.