Extract from .txt file to Excel using macro

nivinvarughese

New Member
Joined
Jul 20, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I am pretty new to VBA,

I have this .txt file which i want to extract to Excel, would appreciate any help or suggestions.

BATCH (Shift) Statistics

Time: 07:00 Date: 17/05/2021


Batch Code: 261720
Batch Start: 23:50 16/05/2021
Batch Number: 4
Next Batch Print: 07:00 17/05/2021

Nominal Weight: 6800.0 g
Tolerable Negative Error: 102.0 g
-T1 Weight: 6698.0 g
-T2 Weight: 6596.0 g
Tare Weight: 103.0 g
Low Reject: 6596.0 g
High Reject: 7100.0 g

Packs Weight
Accepted: 1936 13279.8 kg
-T1 -T2: 25 166.9 kg

Rejected: 20 131.0 kg
High: 3 21.5 kg
Low: 8 47.8 kg
Low Mean: 0 0.0 kg
-T1 -T2: 0 0.0 kg

Total: 1956 13410.8 kg

Mean Weight: 6859.4 g
Standard Deviation: 46.225 g
-T1 -T2% ( Max 2.50 %): 1.29 %
-T2 Packs: 8
Mis-weigh Packs = 0eeeeeeee
Metal Rejects = 9Pks
Giveaway = 115.0 kg
Giveaway% = 0.87 %
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the Board!

You can get a lot of VBA code simply by turning on the Macro Recorder, and recording yourself performing the action manually. So if you turn on the Macro Recorder, and import the file in the manner that you like, you will get a lot of VBA code that you need for this.
See here: Import or export text (.txt or .csv) files

Typically, you can do some clean-up (for efficiency sake), and make some edits to make it more dynamic.
We can help you with that, but if there are specific requirements that you have around this, you must list them here for us.
 
Upvote 0

Forum statistics

Threads
1,217,215
Messages
6,135,256
Members
449,924
Latest member
freeveil

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