[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 69
  • 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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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