textbox strings

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
I have the following strings script to put values in text boxes.
This script is just a example script.
If the value in the strings i.e. strings(0) is a number how do I store it as a number in the textbox and not text.

Code:
Dim Strings() As String
Strings = Split(textbox1.Value)

me.textbox2.value = strings(0)
me.textbox3.value = strings(1)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
.
.

In VBA you can use the following functions to convert expressions to another data type:

CBool - Converts an expression to a Boolean data type
CByte - Converts an expression to a Byte data type
CCur - Converts an expression to a Currency data type
CDate - Converts an expression to a Date data type
CDbl - Converts an expression to a Double data type
CDec - Converts an expression to a Decimal data type
CInt - Converts an expression to an Integer data type
CLng -Converts an expression to a Long data type
CSng - Converts an expression to a Single data type
CStr - Converts an expression to a String data type
CVar - Converts an expression to a variant data type
 
Upvote 0
TextBoxes can only contain strings, they can't contain numbers.
They can contain numerals, which are strings, like "23", but not a number, like 23.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top