Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Deleteing a portion of a cell.

I have a problem I am not sure how to solve. Until now I have been
doing this process row by row myself.

One column of my datatable contains Purchase Orders Numbers prior to
the purchased item list. The PO#'s always begin with Y851and can be
upwards of 20 digits beyond that (ex. Y8518945 or Y85199753532453564356
both are valid PO#'s that could arise etc.) There is always a space
separating the PO# from the item list. What I am in need of is a macro
that will delete the PO#'s from each row if I were to select the entire
column, but that would leave the item list following the PO# untouched.

Any help would be greatly appreciated.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleteing a portion of a cell.


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Deleteing a portion of a cell.

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Deleteing a portion of a cell.

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleteing a portion of a cell.


Did you try my formula?

I put this in A1: Y8513654 Chair
put this in B1: =RIGHT(A1, LEN(A1)-SEARCH(" ",A1)) and got Chair

I put this in A2: Y851365884 Desk
put this in B2: =RIGHT(A2, LEN(A2)-SEARCH(" ",A2)) and got Desk

....


--
Bearacade


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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Deleteing a portion of a cell.

Hi JokerFrowns

Split Y815678954 Chair, Desk, Pencil for me, please.

Cell A1: Y815678954 Chair, Desk, Pencil.....
Cell ?: Y815 and cell ?: Chair, Desk, Pencil....

--
Best regards
Joergen Bondesen


"JokerFrowns" wrote in message
ups.com...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract portion of cell contents Rick[_10_] Excel Worksheet Functions 7 December 19th 09 12:27 AM
vLookup a portion of a no. in a cell kattay Excel Worksheet Functions 3 September 23rd 09 04:18 AM
Extract portion of a cell Secret Squirrel Excel Discussion (Misc queries) 4 October 26th 08 05:24 AM
Buttons in lower portion of workbook appear in upper portion ToferKing Excel Programming 1 April 22nd 06 06:46 PM
deleteing a range from one cell within it? Greg Little Excel Programming 4 August 22nd 05 01:48 PM


All times are GMT +1. The time now is 12:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"