1

Im trying to pass a textbox name from one module to another and then assign a value to that textbox.

Here's what I was trying.

Sub MyTest(txt as Textbox)
txt.value = 1
end sub

sub Try()
MyTest userform1.textbox1
end sub

Can someone point me in the correct direction?

1 Answer 1

1

All I needed to do was change (txt as textbox) to (txt as control) Thank you.

Sub MyTest(txt as Control)
txt.value = 1
end sub

sub Try()
MyTest userform1.textbox1
end sub
Sign up to request clarification or add additional context in comments.

1 Comment

You should also be able to do it as As MSForms.TextBox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.