View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Remove and Add Text to Numbers

for VBA
MyString
VAL(mid(MyString,2,Instr(MyStr," ")-1))


Just to point out to the OP... I'm guessing you meant to write MyString
whereas you wrote MyStr instead.

By the way, here is another what to get the number out in VBA...

--Mid(Split(MyString)(0),2)

Although if the "code number" in the front is always constructed as shown,
you could get the number portion directly....

--Mid(MyString,2,5)

Rick