Dear MS Excel Expert.
I am trying to do the following. I want to access textboxes dynamically using a strMyTextBox variable. Is there such thing as Control or TextBox collection for UserForms?
>> My attempt >>
What is the Syntax to do this?UserForms.Item(0).TextBoxes(strMyTextBox).value = "myValue"
Thank you.
Though I am not so sure about what your exact requirement is.. but following code might help you..
Let me know if this helps..Dim f As Control For Each f In Me.Controls If InStr(f.Name, strMyTextBox) Then f.Value = "myValue" End If Next
Hi, Just an alternative:-
Regards MickPrivate Sub CommandButton1_Click() Dim Txbox As Control, c As Integer For Each Txbox In UserForm9.Controls If TypeName(Txbox) = "TextBox" Then MsgBox Txbox.Name c = c + 1 Txbox.Value = c End If Next Txbox End Sub
Thank you guys.
Peter
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks