Text Boxes

waggy30

New Member
Joined
Mar 2, 2002
Messages
46
I have two problems.

The first is is it possible to have six textboxes, that all go to the same cell. For example six names all going to a cell, all separated by a comma.

The second is it possible to use that cell, and use it as inputs for six textboxes. Basically The reverse of the first problem.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
you mean get each text box to be in control of part of an array?

Would it not be easeier to use 6 different cells and then concatenate these into another cell?
_________________
Regards,

Gary Hewitt-Long
This message was edited by gplhl on 2002-03-07 11:09
 
Upvote 0
Thanks. I couldn't get it to work. I don't know how to create arrays. However, i found a different way to solve problem 1.

To solve problem two, I was thinking about using some code to search for commas and then return the value i want.

For example, in one cell i have

Peter, Jim, Bob, Fred, Geoff, Jack


What I want to do is put Peter in txtbox1, Jim in txtbox2 and so on (only a maximum of six). Does anyone know how to do this?
 
Upvote 0
From the menu, choose Data, Text to columns, Delimited (using comma). This should work.

On 2002-03-07 11:36, waggy30 wrote:
Thanks. I couldn't get it to work. I don't know how to create arrays. However, i found a different way to solve problem 1.

To solve problem two, I was thinking about using some code to search for commas and then return the value i want.

For example, in one cell i have

Peter, Jim, Bob, Fred, Geoff, Jack


What I want to do is put Peter in txtbox1, Jim in txtbox2 and so on (only a maximum of six). Does anyone know how to do this?
[/quote]
 
Upvote 0
Here's some code that will do number 2 as well.

<pre>
Public Sub ExtractNames()

Dim iLength As Integer
Dim sFullText As String
Dim iThisFoundComma As Integer
Dim iLastFoundComma As Integer
Dim iCommaCount As Integer
Dim i As Integer
Dim sArray() As String
Dim sChar As String

sFullText = Sheets("Sheet1").Range("A1").Value
iLength = Len(sFullText)



For i = 1 To iLength
sChar = Mid$(sFullText, i, 1)
If sChar = "," Then
iThisFoundComma = i
iCommaCount = iCommaCount + 1
ReDim Preserve sArray(iCommaCount)
sArray(iCommaCount) = Mid$(sFullText, (iLastFoundComma + 1), (i - iLastFoundComma - 1))
iLastFoundComma = i
End If
Next

Dim test As String
For i = 1 To iCommaCount
test = test & sArray(i) & vbNewLine
Next

MsgBox test

End Sub
</pre>
 
Upvote 0

Forum statistics

Threads
1,223,516
Messages
6,172,777
Members
452,477
Latest member
DigDug2024

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