PDA

View Full Version : Solved: Delete after first space



GohLS
02-15-2011, 09:03 AM
Hi All,

working on a code which will delete after the first space and keep the rest of the chara or value.

Eg: this-123-is-a-fox jumping over the wall
to "this-123-is-a-fox"

Total of chara may vary and there is no standard number of chara in the front.

so i just want to keep the front chara after the first space.

Tried
Range("A2") = Left$(.Value, InStrRev(.Value, " "))
NOt really working cos only delete the last space onwards.
Pls Help

Thanks

Bob Phillips
02-15-2011, 09:10 AM
Try a formula

=LEFT(A2,FIND(" ",A2)-1)

Bob Phillips
02-15-2011, 09:11 AM
In your code, replace InStrRev with InStr.

GohLS
02-15-2011, 09:45 AM
Bothe work well.. thanks..alots