PtitePomme
New Member
- Joined
- Oct 19, 2015
- Messages
- 3
Hi there,
Thanks for spending time considering my problem,
I'm new to VBA (and not familiar with coding in general)..
Anyway, my company wants me to create a VBA macro in order to export some columns of a sheet into a CSV file. (with semicolon separator)
This CSV file will then be used to add data in our ERP and need a specific format.
My problem is :
I have to copy columns : B, C, E, F & J.
I'm able to do this.
What I can't handle is that I need to paste data included in columns B & C into the same section (two columns into a new one), the same for E & F, J column is still single.
Then, I create a new "column" which will contain a "1" in each cell.
Example (with fake data) :
[TABLE="width: 500"]
<tbody>[TR]
[TD]Brand (B)[/TD]
[TD]Name (C)[/TD]
[TD]Power (E)[/TD]
[TD]Unit (F)[/TD]
[TD]Diesel/Petrol (J)[/TD]
[/TR]
[TR]
[TD]Porsche[/TD]
[TD]911 GT3[/TD]
[TD]415[/TD]
[TD]hp[/TD]
[TD]Petrol[/TD]
[/TR]
[TR]
[TD]Ferrari[/TD]
[TD][/TD]
[TD]500[/TD]
[TD]hp[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Aston Martin[/TD]
[TD]V8 Vantage[/TD]
[TD][/TD]
[TD]hp[/TD]
[TD]Petrol[/TD]
[/TR]
[TR]
[TD]Citroën[/TD]
[TD]Xsara[/TD]
[TD]90[/TD]
[TD]cv[/TD]
[TD]Diesel[/TD]
[/TR]
</tbody>[/TABLE]
Output :
Porsche 911 GT3; 415hp; Petrol; 1
Citroen Xsara; 90cv; Diesel; 1
Another problem I cannot handle is that I must not paste rows for which one of the column is empty.
If I create a CSVMSDOS file (semicolon separator) I also have to check if I have an accented character and replace them, what I did doesn't work... (yes, I'm French
)
Thanks if you can provide me some help!
Regards,
Quentin.
Thanks for spending time considering my problem,
I'm new to VBA (and not familiar with coding in general)..
Anyway, my company wants me to create a VBA macro in order to export some columns of a sheet into a CSV file. (with semicolon separator)
This CSV file will then be used to add data in our ERP and need a specific format.
My problem is :
I have to copy columns : B, C, E, F & J.
I'm able to do this.
What I can't handle is that I need to paste data included in columns B & C into the same section (two columns into a new one), the same for E & F, J column is still single.
Then, I create a new "column" which will contain a "1" in each cell.
Example (with fake data) :
[TABLE="width: 500"]
<tbody>[TR]
[TD]Brand (B)[/TD]
[TD]Name (C)[/TD]
[TD]Power (E)[/TD]
[TD]Unit (F)[/TD]
[TD]Diesel/Petrol (J)[/TD]
[/TR]
[TR]
[TD]Porsche[/TD]
[TD]911 GT3[/TD]
[TD]415[/TD]
[TD]hp[/TD]
[TD]Petrol[/TD]
[/TR]
[TR]
[TD]Ferrari[/TD]
[TD][/TD]
[TD]500[/TD]
[TD]hp[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Aston Martin[/TD]
[TD]V8 Vantage[/TD]
[TD][/TD]
[TD]hp[/TD]
[TD]Petrol[/TD]
[/TR]
[TR]
[TD]Citroën[/TD]
[TD]Xsara[/TD]
[TD]90[/TD]
[TD]cv[/TD]
[TD]Diesel[/TD]
[/TR]
</tbody>[/TABLE]
Output :
Porsche 911 GT3; 415hp; Petrol; 1
Citroen Xsara; 90cv; Diesel; 1
Another problem I cannot handle is that I must not paste rows for which one of the column is empty.
If I create a CSVMSDOS file (semicolon separator) I also have to check if I have an accented character and replace them, what I did doesn't work... (yes, I'm French

Thanks if you can provide me some help!
Regards,
Quentin.
Last edited: