Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Freshman Excel Worksheet Functions 4 November 9th 06 01:04 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM
userform help Jason Excel Programming 1 October 22nd 04 05:43 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM
Userform inside another userform Ryan Excel Programming 0 April 23rd 04 08:01 PM


All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"