Link to home
Start Free TrialLog in
Avatar of Brian Smith
Brian Smith

asked on

I'd like to delimit my text in column B (like text-to-columns feature) without having to pre-allocating free space on the right side.

Hi Experts,

I would like to use VBA to help me perform the following task:

Example:

A                     B                                                C
Invoice No.   Model Name.                           Cust Name
0001              BMW X5,Audi A4                     Lisa Marie Presley
0002              Volvo S80, Jaguar XJ,Audi A6  Johnny Depp
0003              Acura NSX                                 Angelina Jolie

I need a script to automatically sort the model of each invoice.

Example:

A                     B                                                C
Invoice No.   Model Name.                           Cust Name
0001              Audi A4, BMW X5,                     Lisa Marie Presley
0002              Audi A6, Jaguar XJ,Volvo S80   Johnny Depp
0003              Acura NSX                                  Angelina Jolie

And then immediately delimit text (aka Convert Text to Columns) in column B without having to overwriting data in column C.
 
Any idea how to write a script module to perform the above?


Please advice.

Thank you.

Brian
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

where do you want the extra data from column B to go? Why not just move what is in column B to the last column and use Text-to-Columns?
Avatar of Brian Smith

ASKER

Hi Crystal,

Thank you for your response and sorry for the confusion,

Allow me clarify this further. Below is the desired output that I am trying to achieve (in full/semi-automation):

A                     B                        C                D                 E
Invoice No.   Model Name                                          Cust Name  
0001              Audi A4              BMW X5                       Lisa Marie Presley
0002              Audi A6,             Jaguar XJ   Volvo S80   Johnny Depp
0003              Acura NSX                                               Angelina Jolie

Once this is achieve, i will need to run  a macro template to auto pivot out the desired monthly table & chart before passing to other dept for further actions.

P/S: The data showing here is just a simplified version of mock-run data to illustrate and for better/easier to understand. But in reality, the xls data file is actually sharing among multiple dept and consisting hundreds of columns and thousands rows of value (and I am not allow  to make any modification in row/column format, otherwise the macro template will not work and will also create confusion to other dept).

Hope I had answer your question.

Thanks again.
Additional Info:

I had tried the VBA script suggested on this Youtube tutorial:

https://www.youtube.com/watch?v=gZD0V2mJSCk

However, the  example given is this video is with an assumption that, the value of sSeparotor (e.g. dash, comma, etc) of every row  is always the same.

So, it doesn't apply to my case scenario, where the total number of comma in every row of column B is not fix.

It can be up to any value, depends on how many cars has ordered by the particular customer in that specific invoice.
ASKER CERTIFIED SOLUTION
Avatar of Ejgil Hedegaard
Ejgil Hedegaard
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much Ejgil! it is works like a charm!  :)