How do i search for a caridge return line feed

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,


Who is Participating?
Ioannis ParaskevopoulosConnect With a Mentor Commented:
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.
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


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


CraigLazarAuthor Commented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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))
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


where mycharracter code is the code you will have seen on the immidiate window
Ioannis ParaskevopoulosCommented:
Or you may copy paste the results here so i can help you.

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


    myArray = Split(sYourString, vbCr)

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

Hope this helps.
CraigLazarAuthor Commented:
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 ?

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...


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

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.

All Courses

From novice to tech pro — start learning today.