MartinS13X
New Member
- Joined
- Apr 4, 2018
- Messages
- 17
- Office Version
- 2019
- Platform
- Windows
I am trying to import a CSV file into excel via VBA and have it split the text into several columns based on "standard"-delimiters such as "," and also split it at certain words appearing in the text.
Below is an (edited) excerpt of the csv file:
(The current file is about 700 lines, but will become longer)
Obviously, splitting the text on the "," delimiter gives me the 5 columns but I'd like to split the description further. One would think splitting it on "-" would work, but of course there's always this exception that messes things up.
If I could split the description on the words "Date" and "Card" (and/or other keywords/delimiters) it would help me a lot. So it would (probably) look like this:
[TABLE="class: grid, width: 750"]
<tbody>[TR]
[TD]06/01/2019[/TD]
[TD]Supermarket - Visa Purchase - Receipt 14883[/TD]
[TD]05 Jan 2019[/TD]
[TD]xxxx[/TD]
[TD][/TD]
[TD]-301.07[/TD]
[TD]180.13[/TD]
[/TR]
[TR]
[TD]06/01/2019[/TD]
[TD]Random store - Visa Purchase - Receipt 148832[/TD]
[TD]04 Jan 2019[/TD]
[TD]xxxx[/TD]
[TD][/TD]
[TD]-153.66[/TD]
[TD]481.20[/TD]
[/TR]
[TR]
[TD]05/01/2019[/TD]
[TD]Shell Petrol Station - Visa Purchase - Receipt 144494[/TD]
[TD]04 Jan 2019[/TD]
[TD]xxxx[/TD]
[TD][/TD]
[TD]-115.14[/TD]
[TD]634.86[/TD]
[/TR]
[TR]
[TD]04/01/2019[/TD]
[TD]Money Transfer - Deposit[/TD]
[TD]04 Jan 2019[/TD]
[TD][/TD]
[TD]750[/TD]
[TD][/TD]
[TD]0.00[/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance...
Below is an (edited) excerpt of the csv file:
(The current file is about 700 lines, but will become longer)
06/01/2019,Supermarket - Visa Purchase - Receipt 148833 Date 05 Jan 2019 Card xxxx,,-301.07,180.13
06/01/2019,Random Store - Visa Purchase - Receipt 148832 Date 04 Jan 2019 Card xxxx,,-153.66,481.20
05/01/2019,Shell Petrol Station - Visa Purchase - Receipt 144494 Date 04 Jan 2019 Card xxxx,,-115.14,634.86
04/01/2019,Money Transfer - Deposit - Date 04 Jan 2019, ,750.00,,0
Obviously, splitting the text on the "," delimiter gives me the 5 columns but I'd like to split the description further. One would think splitting it on "-" would work, but of course there's always this exception that messes things up.
If I could split the description on the words "Date" and "Card" (and/or other keywords/delimiters) it would help me a lot. So it would (probably) look like this:
[TABLE="class: grid, width: 750"]
<tbody>[TR]
[TD]06/01/2019[/TD]
[TD]Supermarket - Visa Purchase - Receipt 14883[/TD]
[TD]05 Jan 2019[/TD]
[TD]xxxx[/TD]
[TD][/TD]
[TD]-301.07[/TD]
[TD]180.13[/TD]
[/TR]
[TR]
[TD]06/01/2019[/TD]
[TD]Random store - Visa Purchase - Receipt 148832[/TD]
[TD]04 Jan 2019[/TD]
[TD]xxxx[/TD]
[TD][/TD]
[TD]-153.66[/TD]
[TD]481.20[/TD]
[/TR]
[TR]
[TD]05/01/2019[/TD]
[TD]Shell Petrol Station - Visa Purchase - Receipt 144494[/TD]
[TD]04 Jan 2019[/TD]
[TD]xxxx[/TD]
[TD][/TD]
[TD]-115.14[/TD]
[TD]634.86[/TD]
[/TR]
[TR]
[TD]04/01/2019[/TD]
[TD]Money Transfer - Deposit[/TD]
[TD]04 Jan 2019[/TD]
[TD][/TD]
[TD]750[/TD]
[TD][/TD]
[TD]0.00[/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance...