This video shows how to create a Macro to Browse and Copy data from one sheet to another excel sheet.
**********************************************************************************
Sub browse()
Dim Filename As String
Dim SourceW As Workbook
Dim DestinationW As Workbook
Dim len1 As Long
Dim len2 As Long
Set DestinationW = ThisWorkbook
Sheets("Data").Activate
len1 = Cells(Rows.Count, 1).End(xlUp).Row
Range("A2", "D" & len1 + 1).ClearContents
Filename = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", Title:="Select a File")
If Filename = "False" Then Exit Sub
Set SourceW = Workbooks.Open(Filename)
Sheets("Sales Data").Activate
len2 = Cells(Rows.Count, 1).End(xlUp).Row
SourceW.Sheets("Sales Data").Range("A2", "D" & len2).copy DestinationW.Sheets("Data").Range("A2", "D" & len2)
SourceW.Close False
End Sub
********************************************************************
Learn the techniques to work faster 🏃♂️without having to remember 🧠 formulas, with the use of macros! - ABSOLUTELY FREE !
Join my Excel Automation Bootcamp to:
✅ Make your excel sheets more attractive and interactive
✅ Get results on a *single button click*?
✅ Reduce your time spent on excel sheets by 70%
Join the WhatsApp group with the link below :
https://excelautomationacademy.com/
00:00 Introduction & Demo
01:15 Demo
01:45 Code Explanation