Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

change text box form

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Change Text Box form String to Integer

Change Text Box form String to Integer

ResolvedVersion 2003

Daren has attended:
Excel VBA Intro Intermediate course

Change Text Box form String to Integer

I have 2 values form text boxes, These are numeric values When I try to add them to gether (ie 2 + 3) I get the value 23 instead of the value 4

The same values are also put in a cell on a Excel sheet which states that they are stored as text.

Should the string forn the text box be changed to an integer, if so how do you change it

below is the programming

TextBoxIn_Hours + TextBoxOut_Hours1

RE: Change Text Box form String to Integer

Hi Daren, thanks for the query and apologies for the delaying in replying. Your code is concatenating the text rather than adding together the values in the textboxes. Try this code out:

(Val(TextBoxIn_Hours) + Val(TextBoxOut_Hours1))

Hope this helps,

Anthony

RE: Change Text Box form String to Integer

Hi Anthony

This works fine

Thank you very much

Regards

Daren

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Make macros work in newer versions of Excel

If you have created macros in Excel 97 or 2000 that you want to be able to use in 2002/XP or 2003, you may need to alter the macro security settings in the newer version of Excel you are using.

To do this, go to Tools - Options - Security.

Select Macro Security and change the security setting to Low.

Tick the boxes next to 'Trust Add-ins' and 'Trust Visual Basic' and click OK.

After you have restarted Windows, you should then be able to use your macros created in earlier versions of Excel.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.08 secs.