Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Strip first 5 characters from a cell.

I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Strip first 5 characters from a cell.

Assuming the contents of the cell is less than 100 characters in length...

=MID(A1,6,99)

If there can be more than 99 characters, then use a number large enough to
accomodate your longest text.

--
Rick (MVP - Excel)


"Mahnian" wrote in message
...
I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Strip first 5 characters from a cell.

Hi,

You posted in programming so how about:-

Sub sonic()
Dim MyRange As Range
Set MyRange = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
For Each C In MyRange
C.Value = Mid(C.Value, InStr(C.Value, "#") + 1)
Next
End Sub

Mike

"Mahnian" wrote:

I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Strip first 5 characters from a cell.

Rick Rothstein wrote'

Assuming the contents of the cell is less than 100 characters in length...

=MID(A1,6,99)

If there can be more than 99 characters, then use a number large enough to
accomodate your longest text.


Or for any length string =RIGHT(A1,LEN(A1)-5)

Ed Ferrero
www.edferrero.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Strip first 5 characters from a cell.

Sub Sonic was flawless, just what I needed. Even fond of the sub name, so
much so I named the button that calls it Sub Sonic..

Thanks

--Mahnian

"Mike H" wrote:

Hi,

You posted in programming so how about:-

Sub sonic()
Dim MyRange As Range
Set MyRange = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
For Each C In MyRange
C.Value = Mid(C.Value, InStr(C.Value, "#") + 1)
Next
End Sub

Mike

"Mahnian" wrote:

I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Strip first 5 characters from a cell.

Glad I could help

"Mahnian" wrote:

Sub Sonic was flawless, just what I needed. Even fond of the sub name, so
much so I named the button that calls it Sub Sonic..

Thanks

--Mahnian

"Mike H" wrote:

Hi,

You posted in programming so how about:-

Sub sonic()
Dim MyRange As Range
Set MyRange = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
For Each C In MyRange
C.Value = Mid(C.Value, InStr(C.Value, "#") + 1)
Next
End Sub

Mike

"Mahnian" wrote:

I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Strip first 5 characters from a cell.

One way using the macro recorder to use datatext to columns.
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 10/19/2008 by Donald B. Guillett
'

'
Range("B1:B2").Select
Selection.TextToColumns Destination:=Range("B1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(5, 1)), TrailingMinusNumbers:=True

End Sub
cleaned up
Range("B1:B2").TextToColumns Destination:=Range("B1"), _
DataType:=xlFixedWidth,FieldInfo:=Array(Array(0, 1), Array(5, 1))


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mahnian" wrote in message
...
I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Strip first 5 characters from a cell.

Hi,

Here is Don's macro modified and very fast:

Sub Super()
Range([L1], [L65536].End(xlUp)).TextToColumns _
Destination:=[L1], DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 9), Array(5, 1))
End Sub

And if you don't insert the line continuation character this is a one line
macro.

--
Thanks,
Shane Devenshire


"Don Guillett" wrote:

One way using the macro recorder to use datatext to columns.
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 10/19/2008 by Donald B. Guillett
'

'
Range("B1:B2").Select
Selection.TextToColumns Destination:=Range("B1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(5, 1)), TrailingMinusNumbers:=True

End Sub
cleaned up
Range("B1:B2").TextToColumns Destination:=Range("B1"), _
DataType:=xlFixedWidth,FieldInfo:=Array(Array(0, 1), Array(5, 1))


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mahnian" wrote in message
...
I need to remove the first 5 characters from every cell in column L and
replace the new string back into the originating cell.

Example:
337;#Error code
127;#Different Error Code

Would become--

Error Code
Different Error Code

So on and so forth.

Thank you in advance..
--Mahnian



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
Strip Out Four Characters, then Average ryguy7272 Excel Worksheet Functions 7 April 9th 09 01:37 AM
How do i strip off Upper case Characters to another cell in Excel. gugertmk Excel Worksheet Functions 12 March 30th 09 11:56 PM
Strip out the ' at the beginning of cell contents Colin Hayes Excel Discussion (Misc queries) 3 April 19th 08 08:48 PM
STRIP CHARACTERS rpick60 Excel Worksheet Functions 7 December 16th 07 04:39 AM
Strip Alpha Characters out of an Alphanumeric Dataset supersonicf111 Excel Programming 22 January 2nd 04 11:57 PM


All times are GMT +1. The time now is 06:17 AM.

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

About Us

"It's about Microsoft Excel"