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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

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