How do i search for a caridge return line feed

Hi
i am copying data from excel say 10 cels of data,
i am then taking the clipboard into a variable,
i need to write a function to take the values and put them
into seperate variables, but the values are seperated by a little square,
which is a caridge return,

thanks

LVL 4
CraigLazarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ioannis ParaskevopoulosCommented:
There is the split function,which splits a string to a string array using a specific delimeter.To be more specific i will give you an example.

Lets say you have a sentence ,ex. "Hello my dear friend"

If you write this code

dim mystring as string
dim myarray() as string

mystring = "Hello my dear friend"

myarray=split(mystring," ") 'Which means that you separate each word and the dilimeter is a blank " "


After executing this you will have the following array


myarray(0)="Hello"
myarray(1)="my"
myarray(2)="dear"
myarray(3)="friend"

If you need to have carriage return as the dilimeter use it like this

myarray=split(mystring,vbcr)




0
CraigLazarAuthor Commented:
hi
sorry did not work
1      2      5      4      5      6      7      8      9      10

here is the data i am working with from the clip board - when i paste it into my text box,
i get little pipe symbols, i need to be able to read the values between the pipes, i tried the replace functiion aswell as vbcr,cbcrlf,vblf - none of them picked them up
0
Ioannis ParaskevopoulosCommented:
Then propably it is not one of those characters.What you can do is using the following sub

Private Sub CharSet(str As String)
For i = 1 To Len(str)
Debug.Print Chr(Asc(Mid(str, i, 1))), "-", Asc(Mid(str, i, 1))
Next
End Sub


When you pass the clipboard to a variable

call this sub like this


CharSet yourClipBoardVariable

With this sub you will know what is the ascii code of the dilimeter character.
Then you may delete the sub and its reference and use

myarray=split(mystring,asc(mycharactercode))

where mycharracter code is the code you will have seen on the immidiate window
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Ioannis ParaskevopoulosCommented:
Or you may copy paste the results here so i can help you.


0
Carl TawnSystems and Integration DeveloperCommented:
To split on a carriage return you can use the VB constant vbCr.

i.e.

    myArray = Split(sYourString, vbCr)

Or, if seperated by a Carriage Return plus a Linefeed then use vbCrLf instead of vbCr.

Hope this helps.
0
CraigLazarAuthor Commented:
hi
thanks for all the help
this is what was in my debug window
(in excell i just had 1 2 3 in 3 cells, i then copied that to the clipboard
1             -              49
              -              9
2             -              50
              -              9
3             -              51

from here could it be the -        9 val ?

0
Ioannis ParaskevopoulosCommented:
9 is the code for tab.So you may put vbtab instead of vbcr.

But then you must be sure that alwayw a tab is the dilimeter,or else you won't get the right results.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jimbobmcgeeCommented:
I expect that Excel copies cells to the clipboard as tab delimeted.  If so, using the above code:

      myArray = Split(sYourString, vbTab)

should do it for you...


HTH

J.
0
CraigLazarAuthor Commented:
hey thanks so mmuch , worked like a peach
daved my bacon there :)

cheers
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.