View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JokerFrowns JokerFrowns is offline
external usenet poster
 
Posts: 28
Default Deleteing a portion of a cell.

That's till not quite correct ... I need the Y851, and ALL following
digits removed (ex. Y815678954 Chair, Desk, Pencil ... would become a
cell just containing the data Chair, Desk, Pencil) ...


Joergen Bondesen wrote:
Hi JokerFrowns

Try below, please.

Option Explicit

'----------------------------------------------------------
' Procedure : Removexxxx
' Date : 20060821
' Author : Joergen Bondesen
' Modifyed by :
' Purpose : Remove x. Eg.Y851xxxx Chair, Desk, Pencil
' Note : Select Range befor Run Removexxxx.
'----------------------------------------------------------
'
Sub Removexxxx()
Dim cell As Range
Dim lenbeforespace As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual


For Each cell In Selection
lenbeforespace = InStr(Trim(cell.Value), " ")

If lenbeforespace = 9 Then
cell.Value = Left(Trim(cell.Value), 4) _
& Mid(Trim(cell.Value), lenbeforespace , Len(Trim(cell.Value)))
End If
Next cell

Application.Calculation = xlCalculationAutomatic
End Sub


--
Best regards
Joergen Bondesen


"JokerFrowns" wrote in message
ups.com...
What it is is in each cell of a column (example A) there is a list,
example (Y8513654 Chair, Desk, Pencil) ... I need the Y851####### gone,
and the list of items to remain the only contents of each cell in the
column.



Bearacade wrote:
Let me see if I understand what you are saying.

So you have 1 column of text, that is basically PO number AND Item
number

So for example PO number is Y85136954 and Item number is 1542A23, you
would see "Y85136954 1542A23" in the cell.

and you want to get rid of the PO number and just leave Item number in
the cell.

Did I get that right?

Assuming that this column is in A:

=RIGHT(A1, LEN(A1)-SEARCH(" ",A1))


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile:
http://www.excelforum.com/member.php...o&userid=35016
View this thread:
http://www.excelforum.com/showthread...hreadid=573846