String problem.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have some worksheets that have the following type of data.

****DATA***** ****DATA***** ****DATA***** ****DATA*****
****DATA***** ****DATA***** ****DATA***** ****DATA*****
****DATA***** ****DATA***** ****DATA***** ****DATA*****
The required data in each string can be found by counting from the
left....or it can be found by testing for the second full stop in the string.
Each worksheet has a different number of rows. I need to take the DATA out
of each cell on the same row and concatenate it and move it to the next
worksheet, then move to the next row and repeat, and form a column of data in
the second worksheet.

any help would be great!!
Thanks in advance

Manny
 
cnt is the count of the first character in the original string you want in
your result string. You want everything from the point to the right

Sub CopyData()
Dim cnt as Long, rw as long
Dim cell as Range, sStr as String, sStr1 as String
rw = 1
cnt = 9
for each cell in Selection
sStr = cell.Text
sStr1 =right(sStr,len(sStr)-(cnt-1))
Worksheets(2).Cells(rw,1).Value = sStr1
rw = rw + 1
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top