Thanks, sorted it with:
Dim SearchString, SearchChar, MyPos, First, Last
SearchString = TextBox1.Value
SearchChar = " "
MyPos = InStr(1, SearchString, SearchChar, 1)
MyPos = MyPos - 1
First = Mid(SearchString, 1, MyPos)
MyPos = MyPos + 2
Last = Mid(SearchString, MyPos)
TextBox2.Value = First
TextBox3.Value = Last
> Some combination of Instr(), Left$(), and Mid$()
>
[quoted text clipped - 13 lines]
>>
>> Thanks
Jezebel - 31 Jan 2006 22:22 GMT
Split() is another possibility that might be better in this case.
1. Add some error-handling in case there is no space at all.
2. Use Trim$() so you don't need to guess how many spaces there are
3. Use the string versions of the sub-string functions (Mid$() rather than
Mid()) -- they are about 1000 times faster.
4. Declare your variables by type. Variants are slow and lead to bugs.
> Thanks, sorted it with:
>
[quoted text clipped - 32 lines]
>>>
>>> Thanks