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
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

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
75,927
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
75,927
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))
 

Watch MrExcel Video

Forum statistics

Threads
1,114,381
Messages
5,547,613
Members
410,803
Latest member
lsweeney
Top