Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey,
I am trying to refrence the name of an object on my userform... I have setup a combobox with the values 1 - 10... the end result is when someone selects a value it creates the the string of text "TextBox" & X (X = number selected from combobox). I then have code that I want to select that object based on the value of generated... any help is greatly appreciated!!! Private Sub ComboBox2_Change() UserForm1.TextBox8.Value = "TextBox" & ComboBox2.Value End Sub Private Sub CommandButton14_Click() Dim ZoneX As String ZoneX = UserForm1.TextBox8.Value ZoneX.SetFocus End Sub Why does this not work? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe...
Private Sub ComboBox2_Change() 'Me is a keyword that refers to the object that owns the code. 'in this case, it's the userform Me.TextBox8.Value = me.controls("TextBox" & me.ComboBox2.Value).value End Sub wrote: Hey, I am trying to refrence the name of an object on my userform... I have setup a combobox with the values 1 - 10... the end result is when someone selects a value it creates the the string of text "TextBox" & X (X = number selected from combobox). I then have code that I want to select that object based on the value of generated... any help is greatly appreciated!!! Private Sub ComboBox2_Change() UserForm1.TextBox8.Value = "TextBox" & ComboBox2.Value End Sub Private Sub CommandButton14_Click() Dim ZoneX As String ZoneX = UserForm1.TextBox8.Value ZoneX.SetFocus End Sub Why does this not work? -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 13, 10:05*pm, Dave Peterson wrote:
Maybe... Private Sub ComboBox2_Change() * *'Me is a keyword that refers to the object that owns the code. * *'in this case, it's the userform * *Me.TextBox8.Value = me.controls("TextBox" & me.ComboBox2.Value).value End Sub wrote: Hey, I am trying to refrence the name of an object on my userform... I have setup a combobox with the values 1 - 10... the end result is when someone selects a value it creates the the string of text "TextBox" & X (X = number selected from combobox). I then have code that I want to select that object based on the value of generated... any help is greatly appreciated!!! Private Sub ComboBox2_Change() UserForm1.TextBox8.Value = "TextBox" & ComboBox2.Value End Sub Private Sub CommandButton14_Click() Dim ZoneX As String ZoneX = UserForm1.TextBox8.Value ZoneX.SetFocus End Sub Why does this not work? -- Dave Peterson- Hide quoted text - - Show quoted text - Awsome!!! Thanks! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey yourself,
It doesn't work because you are trying to set focus to a String. SetFocus applies to objects. Try... Me.Controls(ZoneX).SetFocus -- Jim Cone Portland, Oregon USA wrote in message Hey, I am trying to refrence the name of an object on my userform... I have setup a combobox with the values 1 - 10... the end result is when someone selects a value it creates the the string of text "TextBox" & X (X = number selected from combobox). I then have code that I want to select that object based on the value of generated... any help is greatly appreciated!!! Private Sub ComboBox2_Change() UserForm1.TextBox8.Value = "TextBox" & ComboBox2.Value End Sub Private Sub CommandButton14_Click() Dim ZoneX As String ZoneX = UserForm1.TextBox8.Value ZoneX.SetFocus End Sub Why does this not work? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hopefully a real easy vba question | Excel Discussion (Misc queries) | |||
The real Horizontal Formula question | Excel Discussion (Misc queries) | |||
This may be real simple, but... | Excel Discussion (Misc queries) | |||
Question for the real experts! | Excel Discussion (Misc queries) | |||
Real simple VBA not sure why I cannot paste. | Excel Programming |