![]() |
Text box results to become a Variable
I'd like the input that is going to be entered by a user to become a variable
on my code when running the macro. How do I do that? Thanks |
Text box results to become a Variable
One way is with the InputBox:
myVar = InputBox("Enter Something", "Create Variable") Or typeVar = Application.InputBox("Enter Something", "Create Variable", Type:=1) 'By setting a type in the Application.InputBox Methood, you can force it to be numeric entries (type 1), text entries (type 2) or formulas (type 0), to name a few. The InputBox function does not use a type designation and creates a variant variable. myVar or specVar becomes the variable equal to the value of the entry in the InputBox. "Lucia" wrote: I'd like the input that is going to be entered by a user to become a variable on my code when running the macro. How do I do that? Thanks |
Text box results to become a Variable
Sorry about that, I misread your posting.
myVar = TextBox1.Value 'If you have more than one textbox, you will need to identify the index number or name of the one you want to assign as a variable. "Lucia" wrote: I'd like the input that is going to be entered by a user to become a variable on my code when running the macro. How do I do that? Thanks |
Text box results to become a Variable
Thanks
"JLGWhiz" wrote: Sorry about that, I misread your posting. myVar = TextBox1.Value 'If you have more than one textbox, you will need to identify the index number or name of the one you want to assign as a variable. "Lucia" wrote: I'd like the input that is going to be entered by a user to become a variable on my code when running the macro. How do I do that? Thanks |
All times are GMT +1. The time now is 01:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com