Import text to Excel based on the look of particular line

MichalJB

New Member
Joined
Jun 12, 2013
Messages
4
Hi,

I need to import daily to excel a text file starting from a set row (say row:10). This row always looks more or less like this:

---- ---------- ------------- ---------------- ---------- ----

The number of dashes in each group and number of groups can vary from day to day. Groups are separated with a space. These groups of dashes determine where the columns end, however some fileds in the table below row 10 are empty (very often the first column). When I use import text function in excel the spaces are automatically removed which causes problems, because when first column is empty then data from second column goes to the first and everything gets mixed up. I'm stuck trying to figure out VBA code that would count number of dashes in each group (width of column) and number of groups (number of columns) and then applying it to import text properties. Also the spaces should not be deleted when importing the file.

Can anyone help? Thanks in advance!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,215,518
Messages
6,125,293
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top