Split textbox string to 3 textboxes

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,069
I would like a script that splits the following textbox1. value into 3 parts and puts each value in a textbox.

textbox1.value= 1:26:35

splits it as follows

textbox2.value = 1
textbox3.value = 26
textbox4.value = 35

the value could change though to

textbox1.value = 14:26:35 but will only ever have 2 values between each lot of : so it would never be 143:26:35 etc...
 

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.
Maybe something like

Code:
TextBox1.Value = "14:26:35"
TextBox2.Value = Left(TextBox1.Value, InStr(1, TextBox1.Value, ":") - 1)
TextBox3.Value = Mid(TextBox1.Value, InStr(1, TextBox1.Value, ":") + 1, 2)
TextBox4.Value = Right(TextBox1.Value, 2)


M.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,673
Members
452,937
Latest member
Bhg1984

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