ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data inside Cell Seperated by comma (https://www.excelbanter.com/excel-programming/400735-data-inside-cell-seperated-comma.html)

[email protected]

Data inside Cell Seperated by comma
 
Is there any Way to pull data from a cell, then store that in an
array, then split the data and set it in 2 different text boxes??
for instance the name John Monroe
MyString = John, Monroe

TextBox1.text = John
TextBox2.text = Monroe
Im not really sure how to do this, My spreadsheet is already fairly
large, so im trying to hide multiple items inside a s ingle cell now,
MyString will be selected from a combobox, if that helps any :|


Sun Tzu

Data inside Cell Seperated by comma
 
On Nov 7, 8:13 am, wrote:
Is there any Way to pull data from a cell, then store that in an
array, then split the data and set it in 2 different text boxes??
for instance the name John Monroe
MyString = John, Monroe

TextBox1.text = John
TextBox2.text = Monroe
Im not really sure how to do this, My spreadsheet is already fairly
large, so im trying to hide multiple items inside a s ingle cell now,
MyString will be selected from a combobox, if that helps any :|


Versions of Excel after 97 have the "Split" function that should help.

Dim strA as String
Dim strB as String
Dim strC as String
Dim strX as String
Dim vntX as Variant
strX = "a,b,c"
vntX = Split(strX, ",")
strA = vntX(0) ' "a"
strB = vntX(1) ' "b"
strC = vntX(2) ' "c"


DomThePom

Data inside Cell Seperated by comma
 
if you are sure that your values will be seperated by a comma then use the
instr function:

TextBox1.text = left(cbo.value,instr(1, cbo.value,",")-1) 'pulls all text
to the left of the comma

TextBox2.text = right(cbo.value,trim(len(cbo.value) - instr(1,
cbo.value,","))) 'pulls all text to the right of the comma

" wrote:

Is there any Way to pull data from a cell, then store that in an
array, then split the data and set it in 2 different text boxes??
for instance the name John Monroe
MyString = John, Monroe

TextBox1.text = John
TextBox2.text = Monroe
Im not really sure how to do this, My spreadsheet is already fairly
large, so im trying to hide multiple items inside a s ingle cell now,
MyString will be selected from a combobox, if that helps any :|



[email protected]

Data inside Cell Seperated by comma
 
On Nov 7, 8:42 am, Sun Tzu wrote:
On Nov 7, 8:13 am, wrote:

Is there any Way to pull data from a cell, then store that in an
array, then split the data and set it in 2 different text boxes??
for instance the name John Monroe
MyString = John, Monroe


TextBox1.text = John
TextBox2.text = Monroe
Im not really sure how to do this, My spreadsheet is already fairly
large, so im trying to hide multiple items inside a s ingle cell now,
MyString will be selected from a combobox, if that helps any :|


Versions of Excel after 97 have the "Split" function that should help.

Dim strA as String
Dim strB as String
Dim strC as String
Dim strX as String
Dim vntX as Variant
strX = "a,b,c"
vntX = Split(strX, ",")
strA = vntX(0) ' "a"
strB = vntX(1) ' "b"
strC = vntX(2) ' "c"


Ty It works Perfectly!!! I owe you and this form, It has been an
incredible help to me, I appreciate All of you!



All times are GMT +1. The time now is 03:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com