Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Value
Hi,
I am quite new to VB and suspect my problem is due to lack of knowing the fundamentals of structuring procedures etc. My macro brings up a user form at the beginning which includes a text box. The macro then goes through quite a lot of code and towards the end I want to refer to the value of the text box. I have tried referring to it as : €śUserForm1.Textbox1.value€ť to use the value in a calculation but I get the error : Run-time error 13 Type Mismatch Do I have to add any code within Private Sub TextBox1_Change() ? or declare a variable somewhere in my macro ? Thanks in advance for any help anyone can provide. Regards Pete |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Value
Pete,
It sounds as though you are trying to load a string (the textbox value) into an integer or long variable. Try CInt(Userform1.Textbox1.Value) -- HTH ------- Bob Phillips "Pete" wrote in message ... Hi, I am quite new to VB and suspect my problem is due to lack of knowing the fundamentals of structuring procedures etc. My macro brings up a user form at the beginning which includes a text box. The macro then goes through quite a lot of code and towards the end I want to refer to the value of the text box. I have tried referring to it as : "UserForm1.Textbox1.value" to use the value in a calculation but I get the error : Run-time error 13 Type Mismatch Do I have to add any code within Private Sub TextBox1_Change() ? or declare a variable somewhere in my macro ? Thanks in advance for any help anyone can provide. Regards Pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform | Excel Worksheet Functions | |||
Access from add_in userform to main template userform.... | Excel Programming | |||
userform help | Excel Programming | |||
Linking userform to userform in Excel 2003 | Excel Programming | |||
Userform inside another userform | Excel Programming |