View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Edit within a cell to select parts

Is it the case that the number portion will contain zero spaces and will
always end with a space? If so, use something like

Sub AAA()
Dim Pos As Integer
Dim S As String
S = Range("A1").Text
Pos = InStr(1, S, Chr(32), vbBinaryCompare)
If Pos Then
Debug.Print Left(S, Pos - 1)
Range("B1").Value = Left(S, Pos - 1)
Else
Debug.Print "no space found"
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"fatherof5clones" wrote in
message ...
I have a spreadsheet of order numbers/names in one cell like this
20070001 Mickey Mouse
20070003 Daffy Duck
2006001222 Mini Mouse
200500345 Pluto

In VB, is there a way to select out just the number, cut it out, and paste
in different cell? Just have a few hundred to do and parsing the cell by
space requires a recombine of all the names. Thanks.