vba - Use file picker to find specific documents then copy and paste -


after find file paths want able copy data 6 7 of workbooks selected , paste them active file. getting me started here great.

dim wb workbook dim mypath string dim myfile string dim myextension string dim fldrpicker filedialog  'optimize macro speed   application.screenupdating = false   application.enableevents = false   application.calculation = xlcalculationmanual  'retrieve target folder path user   set fldrpicker = application.filedialog(msofiledialogfolderpicker)      fldrpicker       .title = "select target folder"       .allowmultiselect = false         if .show <> -1 goto nextcode         mypath = .selecteditems(1) & "\"     end  'in case of cancel nextcode:   mypath = mypath   if mypath = "" goto resetsettings  'target file extension (must include wildcard "*")   myextension = "*.xls*"  'target path ending extention   myfile = dir(mypath & myextension)  'loop through each excel file in folder   while myfile <> ""     'set variable equal opened workbook       set wb = workbooks.open(filename:=mypath & myfile)      'ensure workbook has opened before moving on next line of code       doevents 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -