converting text to numeric

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
I the last userform I set up for my daughter, I used a different text box for each cell of a matrix. (Thus if I had a 3X3 matrix, there would be nine text boxes). Some of the responses on ths board seemed to indicate that I should have used one text box for the entire matrix. If I were to do this - how would I convert the text into a numeric array?

Gene, "The Mortgage Man", Klein
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
**bump**

I'm guessing that this is not a very easy thing to do!

When I think about it, I come up with at least two loops with a number of checks on the way. I'm just not sure what (systemish) information the text box has after the user is done (are there end of line characters in each row for example?)


Gene, "The Mortgage Man", Klein
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
Gene

I can't really see why 1 textbox would be better.

Surely it would just complicate things.

How exactly would you enter a matrix into 1 textbox for example?

How would you delimit the rows/columns?
 

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
I agree, I don't think 1 textbox would be better either. Like I said, some of the responses in a previous post indicated that they (the responders) thought I had set it up with one text box. So I thought that it might have been a better way.

There are advantages to 1 textbox of course. You don't have to worry about getting the tab order correct. The underlying software can - in some respects - be less complex. Of course this is done at the expense of adding other complexities. That's what THIS post was about. To answer you questions - columns would be delimited by spaces. The rows
was my question in the post before yours: does the text box give you end of line characters. That would delimit the rows

From your post, I assume that a subroutine to convert the text box into
a numeric array is not "out there" and the best way to handle this is through one textbox/cell

Gene, "The Mortgage Man", Klein
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
Gene

You probably could split a multiline textbox, if that's what you mean, using Char(10) as a delimiter.
Code:
Dim arrRows
    arrRows = Split(TextBox1.Text, Chr(10))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,127
Messages
5,857,525
Members
431,883
Latest member
Hien

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
Top