Importing txt data into an existing excel sheet

Hacklin337

New Member
Joined
Jul 9, 2021
Messages
3
Office Version
  1. 2010
Hello, I just began my adventure with VBA and I need it to ease my job a lot- i have a .txt file with data divided by semicolons and an already made excel spreadsheet.
Is there any way to import the data from the file directly to the excel form (not a new one)?
In addition, can it add rows according to the data given?

The txt file looks like this:
Place1; 62; 27.1382; N; 004; 53.9129; E; 273.3; 2.3; 500.0; 500.0; ; ; 0.0; ; ; 0.0; 00:00 W; 0.0
Place2; 62; 30.7312; N; 004; 40.4700; E; 300.1; 7.2; 900.0; 800.0; ; ; 0.0; ; ; 0.0; 00:00 W; 0.0
Place3 .......

There is no need for deleting any rows, some just are empty.
Pretty much i want to use a macro and fill a table.
Thanks for any help :)
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello, I just began my adventure with VBA and I need it to ease my job a lot- i have a .txt file with data divided by semicolons and an already made excel spreadsheet.
Is there any way to import the data from the file directly to the excel form (not a new one)?
In addition, can it add rows according to the data given?

The txt file looks like this:
Place1; 62; 27.1382; N; 004; 53.9129; E; 273.3; 2.3; 500.0; 500.0; ; ; 0.0; ; ; 0.0; 00:00 W; 0.0
Place2; 62; 30.7312; N; 004; 40.4700; E; 300.1; 7.2; 900.0; 800.0; ; ; 0.0; ; ; 0.0; 00:00 W; 0.0
Place3 .......

There is no need for deleting any rows, some just are empty.
Pretty much i want to use a macro and fill a table.
Thanks for any help :)
I you should use powerquery much simpler than a macro and don't need to save the file as a macro enabled, go to Data/From Text/CSV then transform data, in the powerquery window you can easily filter out any empty rows, then "close and load to" and you can select a table. is pretty easy to use just with the user interface, no code needed
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,189
Members
449,213
Latest member
Kirbito

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