Appropriate Display of a string in combobox unable to put "," at correct placement with Split

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
205
Hi I've been banging my head just for simple formating using Split

Can some help me to correct

VBA Code:
dim myArrayList as Variant, txtString As String
dim RowNo as Long
dim ColNo as Long

txtString = txtString & RowNo & ","  & ColNo & " "
myArrayList = Split(txtString,", ")
Combobox1.List = myArrayList

what i am getting in combobox1
1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3 4,1 4,2 4,3 5,1 5,2 5,3 6,1 6,2 6,3 7,1 7,2 7,3

What is correct format by using Split function to get desired below correct formatting for Combobox
So that values in comboBox to get following i.e RowNo Comma/Delimeter Space and ColNo below is the structure
1, 1
1, 2
1, 3
2, 1
2, 2
and so on...
SamD
188
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You are splitting on a sequence that is not present in the string. You could do something like this:

Code:
txtString = txtString & RowNo & ", "  & ColNo & "^"
myArrayList = Split(txtString,"^")
 
Upvote 0
Solution
RoryA
You are splitting on a sequence that is not present in the string. You could do something like this:
Ok, Realised

VBA Code:
txtString = txtString & RowNo & ", "  & ColNo & "^"
myArrayList = Split(txtString,"^")

Thank you ! Works Perfectly :)
SamD
189
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

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