#1   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Pick lists

Direction needed....
I have a column of data that I need to create a pick list from. The data is
seperated by spaces (non uniform). I can create a Named list from the column
but need to remove the spaces between items. Any ideas? One thought I had was
to push the data to another sheet and build it without the spaces, then
create the list. Is this possible? If so, does anyone have some pointers for
me? Or other ideas?

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Pick lists

Can you use TRIM to remove spaces at the end and beginning of the string?

If you need to remove intervening spaces then you could just iterate the
string looking for spaces and rebuild by adding back the before and after
parts of the string.

Function DeSpacer(xValue As String) As String
' function to remove all spaces within a string
DeSpacer = xValue
' remove end spaces
xValue = Trim(xValue)
Dim x As Integer, xL As Integer
' remove intervening spaces
For x = 1 To Len(xValue)
xL = InStr(xValue, " ")
If xL 0 Then
xValue = Left(xValue, xL - 1) & Mid(xValue, xL + 1, Len(xValue) -
xL)
End If
Next
DeSpacer = xValue
End Function

To call this function use.....

mystring = DeSpacer(mystring)

--
Cheers
Nigel



"Ron" wrote in message
...
Direction needed....
I have a column of data that I need to create a pick list from. The data
is
seperated by spaces (non uniform). I can create a Named list from the
column
but need to remove the spaces between items. Any ideas? One thought I had
was
to push the data to another sheet and build it without the spaces, then
create the list. Is this possible? If so, does anyone have some pointers
for
me? Or other ideas?

Thank you.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pick from lists rbrickl Excel Worksheet Functions 1 July 26th 06 12:28 AM
Using Pick Lists Awetronics Excel Worksheet Functions 2 November 2nd 04 09:06 AM
Pick Lists Bob Phillips[_6_] Excel Programming 0 September 22nd 04 12:42 PM
Pick Lists cmart02[_2_] Excel Programming 0 September 22nd 04 11:45 AM
Pick Lists Budget Programmer Excel Programming 0 September 22nd 04 11:31 AM


All times are GMT +1. The time now is 07:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"