• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 76
  • Last Modified:

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
0
Brian Smith
Asked:
Brian Smith
  • 3
1 Solution
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
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?
0
 
Brian SmithAuthor Commented:
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.
0
 
Brian SmithAuthor Commented:
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.
0
 
Ejgil HedegaardCommented:
0
 
Brian SmithAuthor Commented:
Thank you so much Ejgil! it is works like a charm!  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now