ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   crop away the letters (https://www.excelbanter.com/excel-discussion-misc-queries/233873-crop-away-letters.html)

Fan924

crop away the letters
 
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

Bernard Liengme[_3_]

crop away the letters
 
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
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Fan924" wrote in message
...
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




JCS

crop away the letters
 
Hi,

Try =MID(A1,5,7). If this helps please press Yes.

John

"Fan924" wrote:

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


Gary''s Student

crop away the letters
 
Sub dural()
Liscence = "VWXY1234567Z"
CropIt = Left(Right(Liscence, 8), 7)
MsgBox (CropIt)
End Sub

--
Gary''s Student - gsnu2007L


"Fan924" wrote:

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


Fan924

crop away the letters
 
CropIt = Left(Right(Liscence, 8), 7)

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


All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com