crop away the letters

F

Fan924

For the following, I need to crop away the letters with a macro, excel
97
VWXY1234567Z
CropIt = Right(Liscence, 8)
1234567Z

How do I crop away the "Z" leaving only
1234567
 
B

Bernard Liengme

Without using VBA: =--LEFT(RIGHT(A1,8),7)
The double negation is used to convert the resulting text to a number

And this UDF does the same
Function CropIt(mycell)
CropIt = --Left(Right(mycell.Value, 8), 7)
End Function

best wishes
 
G

Gary''s Student

Sub dural()
Liscence = "VWXY1234567Z"
CropIt = Left(Right(Liscence, 8), 7)
MsgBox (CropIt)
End Sub
 
F

Fan924

CropIt = Left(Right(Liscence, 8), 7)

Thanks, I was close by couldn't get the syntax right.
;<]
 
Top