Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Delimiting across multiple columns

Hi
I am interested if a macro exists that will delimit across multiple columns in Excel. My data is as follows and I wish to split the antibiotic from the letter which is 23 characters from the beginning of the column. An example of the data is as follows, I am unsure how to put borders in but the first example Amoxicillin and R is in same cell in Excel, R is 23 Characters from the beginning of the cell. On conversion Amoxicillin and R are in two seperate cells.

Amoxicillin R Vancomycin R Teicoplanin R
Amoxicillin R Nalidixic acid s Teicoplanin s
Amoxicillin R Vancomycin s Teicoplanin s
Amoxicillin R Vancomycin R Teicoplanin S
Amoxicillin S
Amoxicillin R Vancomycin S Nitrofurantoin S
Amoxicillin R Vancomycin s Teicoplanin s
Nitrofurantoin S Vancomycin s
Amoxicillin S Vancomycin s Teicoplanin s

Convert to

Amoxicillin R Vancomycin R Teicoplanin R
Amoxicillin R Nalidixic acid s Teicoplanin s
Amoxicillin R Vancomycin s Teicoplanin s
Amoxicillin R Vancomycin R Teicoplanin S
Amoxicillin S
Amoxicillin R Vancomycin S Nitrofurantoin S
Amoxicillin R Vancomycin s Teicoplanin s
Nitrofurantoin S Vancomycin s
Amoxicillin S Vancomycin s Teicoplanin s


I hope this is clear

Many thanks
Eddie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Delimiting across multiple columns

On Tuesday, December 10, 2013 4:33:44 PM UTC, Claus Busch wrote:
Hi,



Am Tue, 10 Dec 2013 07:24:28 -0800 (PST) schrieb :



Amoxicillin R Vancomycin R Teicoplanin R


Amoxicillin R Nalidixic acid s Teicoplanin s


Amoxicillin R Vancomycin s Teicoplanin s


Amoxicillin R Vancomycin R Teicoplanin S


Amoxicillin S


Amoxicillin R Vancomycin S Nitrofurantoin S


Amoxicillin R Vancomycin s Teicoplanin s


Nitrofurantoin S Vancomycin s


Amoxicillin S Vancomycin s Teicoplanin s




try:



Sub SplitString()

Dim LCol As Integer

Dim i As Integer



With ActiveSheet

LCol = .Cells(1, .Columns.Count).End(xlToLeft).Column



For i = 2 To LCol * 2 Step 2

.Columns(i).Insert

.Columns(i - 1).TextToColumns Destination:=.Cells(1, i - 1), _

DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _

ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, _

Comma:=False, Space:=True, Other:=False, FieldInfo _

:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True

Next

End With

End Sub





Regards

Claus B.

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


Hi Claus
Thanks for this unfortunately it splits column A over 2 columns but but not original columns B and C. I showed 3 columns of data but sometimes there are up to 20 columns that need to be split if this makes a difference.

Eddie
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
problem with test to columns feature identifying odd delimiting character mark_jm via OfficeKB.com Excel Discussion (Misc queries) 4 May 4th 10 11:22 AM
Un-Delimiting caveman.savant Excel Programming 2 April 30th 09 03:09 PM
Delimiting and Formatting Delimiting and Formatting Excel Discussion (Misc queries) 2 May 9th 07 07:26 PM
delimiting w/multiple delimiters? NTaylor Excel Discussion (Misc queries) 0 January 11th 06 04:22 PM
Pasting from clipboard-how to control text-to-columns delimiting stebro Excel Discussion (Misc queries) 1 June 15th 05 05:31 PM


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

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"