Macro: directory 50-70 files -> open first file with notepad -> copy all to excel -> next file in next row

Fientje

New Member
Joined
Feb 1, 2014
Messages
4
Hi,
I am new to this forum and I have the following question.
I can write a makro to open notepad, open a file, and than have it copied to excel.

Sub notepad()
'
' notepad Macro
'
' Sneltoets: CTRL+n
'
ActiveSheet.Paste
Range("A11").Select
ActiveSheet.Paste
End Sub

But what I need is to have a makro that makes sure that all the files within a directory will be copied to excel.
So from the directory named: 'today', open file n, copy all to excel A1, close file n, open file n+1, copy all to row n+1 in excel, etcetera untill all files are copied.

Does this require the files in the directory 'today' to be named in a certain namecode?

Thanks very much in advance!
Fientje
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Sorry, I tried to change the text but was out of the 10 minutes limit. The makro in the above only copy pastes, so I obviously also do not know that part : how to open notepad, open a file and copy all to excel and close notepad.
 
Upvote 0
Maybe I do not need notepad at all; but use import from external sources and change there to all files in the VBA / makro...
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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