Get value from textbox and use it inthe form of Array

AkshayRM

New Member
Joined
Jun 22, 2020
Messages
9
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
Get value from textbox and use it in the form of Array.

So basically what I am doing is,converting fixedwidth file.
I recorded a Macro for that. And delimiting the values. And the below value I am getting from userform. (Bold and underlined)
. TextFileFixedColumnWidths = Array(3, 5, 8, 8, 13...)
so user will enter values in text box like- 3 ,5, 8, 8, 13...)
Now I declared a variable.
Dim delimitvalues As Variant
delimitvalues = UserForm1. Textbook. Value
And then code
.
.
.
. TextFileFixedColumnWidths = Array(delimitvalues)

but this is not working it's shows error-Run time error 5 (Invalid procedure call or argument)
what I understand is it's taking as string and not as array.

Even I tries to remove double quotes by
delimitvalues=Replace(delimitvalues, Chr(34), "")

I tried this also
MyZeroBasedArray = Split (delimitvalues, ", ")

but nothing worked.
please help me on this with whichever method possible.


I hope my question is clear pleas let me know i will clarify.
 
Wow, I never thought in that way.
It's working. Thank you once again. :)
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

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