Macro to copy the data from excel file containing name "_res_av_" in folders and subfolders, copy the required data and paste in another excel file

Swaroop Kavi

New Member
Joined
Aug 25, 2021
Messages
4
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I am looking for a vba code to find an excel file containing file name "_res_av_" in folders and subfolders, open it, copy the content from A1:E10000, paste in another required excel file from A7 to E70007; G7 to K70007 etc. Note that there has to be an empty column between the set of data copied (For example, Column F, L etc., in this case). Also, Copy the excel file names into B2, H2, N2 etc cells.
Thank you
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You can use the same method as I showed you before

VBA Code:
Sub JEC()
   Application.ScreenUpdating = False
   jv = Split(CreateObject("wscript.shell").exec("cmd /c Dir ""C:\Users\xxx\Downloads\*_res_av_*"" /b/s").stdout.readall, vbCrLf)

   For Each it In jv
      If Len(it) Then
         With Workbooks.Open(it).Sheets(1)           
             your code.......

            .Parent.Close
         End With
      End If
   Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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