Excel VBA Macro: Extract Data from All Files in a (User Selected) Folder

greggowaffles February 24, 2023
Video Thumbnail
greggowaffles Logo

greggowaffles

View Channel

About

My mission is to create tutorials that are fun, easy to understand, and connected to real world scenarios.

Video Description

💼 Hire Me for Excel VBA Automation Need help automating your Excel workflows? I specialize in building custom Excel VBA solutions to save you time and eliminate repetitive tasks. 👉 https://www.upwork.com/freelancers/~013bd05e311ebf4a2c Excel VBA Macro: Extract Data from All Files in a (User Selected) Folder 💥Subscribe: https://youtube.com/@greggowaffles Code: Sub grab_data_from_files_in_folder() Dim myPath As String Dim myFile As String Dim FldrPicker As FileDialog Dim sh As Worksheet Dim i As Integer Application.ScreenUpdating = False Set sh = ThisWorkbook.Sheets("Team Summary") Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker) With FldrPicker .Title = "Please Select Folder" .AllowMultiSelect = False .ButtonName = "Confirm!!" If .Show = -1 Then myPath = .SelectedItems(1) & "\" Else End End If End With With sh .Cells.ClearContents .Cells(1, 1) = "Team Name" .Cells(1, 1).Font.Size = 14 .Cells(1, 1).Font.Bold = True .Cells(1, 2) = "Total Sales" .Cells(1, 2).Font.Size = 14 .Cells(1, 2).Font.Bold = True End With myFile = Dir(myPath) i = 2 Do While myFile <> "" Workbooks.Open Filename:=myPath & myFile sh.Cells(i, 1) = ActiveWorkbook.Sheets("Team Sales").Cells(1, 2).Text sh.Cells(i, 2) = ActiveWorkbook.Sheets("Team Sales").Cells(2, 2).Value ActiveWorkbook.Close savechanges:=False myFile = Dir i = i + 1 Loop Application.ScreenUpdating = True End Sub #excelmacro #excelvba

You May Also Like

Excel VBA Mastery Kit

AI-recommended products based on this video

Loading...
Open Office Suite 2024 Professional Edition CD DVD 100% compatible with Microsoft® Word® and Excel® for Windows 10, 8, 7, Vista, XP And Mac OS X

Open Office Suite 2024 Professional Edition CD DVD 100% compatible with Microsoft® Word® and Excel® for Windows 10, 8, 7, Vista, XP And Mac OS X

(137)
$19.97
FREE delivery Sat, Jun 14 on your first order
Loading...
Cozy Corner: Coloring Book for Adults and Kids

Cozy Corner: Coloring Book for Adults and Kids

(974)
$10.92
FREE delivery Wed, Dec 24 on your first order
Loading...
The Complete Baking Book for Young Chefs: 100+ Sweet and Savory Recipes that You'll Love to Bake, Share and Eat!

The Complete Baking Book for Young Chefs: 100+ Sweet and Savory Recipes that You'll Love to Bake, Share and Eat!

(11,737)
$17.99
FREE delivery Fri, Dec 5 on your first order
Loading...
Hello, Baby Animals: A Durable High-Contrast Black-and-White Board Book for Newborns and Babies

Hello, Baby Animals: A Durable High-Contrast Black-and-White Board Book for Newborns and Babies

(7,613)
$7.17$4.20
FREE delivery Tue, Dec 2 on your first order
Loading...
Little Blue Truck's Halloween: A Fun And Interactive Lift-the-Flap Book For Kids Celebrating Halloween With Little Blue Truck And Friends

Little Blue Truck's Halloween: A Fun And Interactive Lift-the-Flap Book For Kids Celebrating Halloween With Little Blue Truck And Friends

(14,340)
$13.13
FREE delivery Fri, Oct 31 on your first order
Loading...
Short USB C Cable [4-Pack 8 inch], SUMPK 3A Fast Charging USB 2.0 Data Transfer to Type C Phone Charger Cord Nylon Braided Compatible with Samsung Galaxy S10 S9, Pixel 3, LG V30, Charging Station

Short USB C Cable [4-Pack 8 inch], SUMPK 3A Fast Charging USB 2.0 Data Transfer to Type C Phone Charger Cord Nylon Braided Compatible with Samsung Galaxy S10 S9, Pixel 3, LG V30, Charging Station

(1,702)
$11.99
FREE delivery Tue, Jun 17 on your first order
Loading...
Syntech Link Cable 16FT for PCVR Compatible with Oculus/Quest 3/Meta Quest 3S, Quest2/Pro/Pico 4/Ultra Accessories and PC/SteamVR, High Speed PC Data Transfer, USB 3.0 to USB C Cable for VR Headset
Best Seller

Syntech Link Cable 16FT for PCVR Compatible with Oculus/Quest 3/Meta Quest 3S, Quest2/Pro/Pico 4/Ultra Accessories and PC/SteamVR, High Speed PC Data Transfer, USB 3.0 to USB C Cable for VR Headset

(19,554)
$24.99
FREE delivery Tue, Jun 17 on your first order
300+ bought in past month
Loading...
USB C Hub Multiport Adapter for MacBook Pro/Air M1 M2 M3 M4 2025-2018, Melelink 8 in 2 Mac USB Adapter Dongle MacBook Accessories with HDMI 4K, Thunderbolt 3, USB C&A Data Ports, SD/TF Card Reader

USB C Hub Multiport Adapter for MacBook Pro/Air M1 M2 M3 M4 2025-2018, Melelink 8 in 2 Mac USB Adapter Dongle MacBook Accessories with HDMI 4K, Thunderbolt 3, USB C&A Data Ports, SD/TF Card Reader

(249)
$24.69
200+ bought in past month
Loading...
UGREEN Revodok USB C Hub, 5-in-1 USB C Adapter with 4K HDMI, 100W Power Delivery, 3 USB A Data Ports, Multiport USB Hub for MacBook Pro/Air, iPad Pro, Surface, XPS, Thinkpad, Galaxy and More, Gray
Best Seller

UGREEN Revodok USB C Hub, 5-in-1 USB C Adapter with 4K HDMI, 100W Power Delivery, 3 USB A Data Ports, Multiport USB Hub for MacBook Pro/Air, iPad Pro, Surface, XPS, Thinkpad, Galaxy and More, Gray

(17,667)
$19.99
3K+ bought in past month