LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 105
Default Splitting cell data into multiple cell information

1. How can I take a long selection of cells and remove in every case the last
character?


Sub test1()
Dim c As Range
For Each c In Selection
c.Value = Left(c.Value, Len(c.Value) - 1)
Next c
End Sub

2. Is there a way in a long selection of data I can eliminate all characters
in a string to the left of or right of a single character or more usefully a
common series of characters in a string? eg., if the word "Contact" appears
in every string how can i get split the data so that everything before the
word "Contact"is separated?


Sub test2()
Dim c As Range
For Each c In Selection
If c.Value Like "*Contact*" Then
c.Value = Right(c.Value, Len(c.Value) - InStr(1, c.Value,
"Contact") + 1)
End If
'if instr(1,c.Value,contact = Left(c.Value, Len(c.Value) - 1)
Next c
End Sub

HTH
Daniel




 
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
REVERSE SINGLE CELL TEXT STRING Tammy Excel Worksheet Functions 2 October 23rd 06 07:49 PM
Splitting data in a single cell that is seperated by commas, then moving to make individual rows [email protected] Excel Discussion (Misc queries) 2 April 3rd 06 10:44 AM
Splitting data out of a single cell davids Excel Discussion (Misc queries) 1 March 22nd 06 12:31 AM
Splitting single column data into two loopkid1 Excel Worksheet Functions 3 January 31st 06 05:24 PM
Splitting a single cell Gina O'Brien Excel Discussion (Misc queries) 3 May 20th 05 01:37 PM


All times are GMT +1. The time now is 06:36 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"