I got this CSV file with 18000+ rows and 7 columns. When I save it to .txt from Excel and open in notepad it shows like this:
10012 CITY 10012 CITY RIKSDAGEN CITY lokal 10
But I want to change it so lets say: the first CITY starts at position 6 (right after the 2 in 10012) and the second 10012 on a fixed position (lets say 26) etc.
I figured I need to swich the ‘tab’ spaces with regular spaces but with 18000+ rows.. yea.
I don’t know if this could be done in vba or if I a program?
EDIT: The positions I want is 6,26,31,51,81
10012CITY 10012CITY RIKSDAGEN CITY lokal 10
1 6 26 31 51 81
One possibility is to prepare data in Excel itself:
A2:H2: String positions (1;6;26..)A3:H3: Your dataI3:=A3&REPT(" ";B$2-A$2-LEN(A3))The formula can be copied to the right and down.
The result will be cells with added spaces, which can be concatenated into a single cell (
=I3&J3...&P3) with spaces in needed locations . The contents of the concatenated cell(s) can be copy-pasted directly to Notepad.Example spreadsheet: http://www.bumpclub.ee/~jyri_r/Excel/Getting_fixed_length_csv_file.xls