Copying from text file to excel

S10th

New Member
Joined
Nov 6, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have to copy data from a text file to excel

I tried recording it but all I managed to get was this:


VBA Code:
Sub Macro1()
'
' Macro1 Macro
'

'
    Range("A1").Select
    ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
End Sub

I was wondering how to open the text file and copy all the contents into A1 (but without wrap text) so each line on the text file is a new one on the excel file - blanks included.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
6,765
Office Version
  1. 365
Platform
  1. Windows
On the data tab of the ribbon, select Get & Transform. From Text/CSV. Bring into PQ Editor and then Close and Load on the Home Tab
 

S10th

New Member
Joined
Nov 6, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Thanks for the quick response! Is there no way to automate? Only reason is I need to run this about 100 times in today every month - the report that is generated by another program (it spits out the same file regardless of the parameters). If it's not possible, I'll take the Get and Transform.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,971
Messages
5,767,391
Members
425,410
Latest member
SmittyT

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
Top