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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

JEC

Active Member
Joined
Aug 21, 2021
Messages
494
Office Version
  1. 365
Platform
  1. Windows
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
 

Forum statistics

Threads
1,144,660
Messages
5,725,652
Members
422,634
Latest member
YenOlmedo

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