Allow Excel users to select a source file and a destination folder. In organizations files can be located in a variety of locations and users do not always want to save them in the same location. Check out my online courses www.easyexcelanswers.com/courses.html
All my courses include online support and a user manual
Let me teach you the VBA that I have learn in my five years of consulting
Let’s take the frustration out of user forms
Become an Affiliate and earn 25% on Course Sales
For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Click for online Excel Consulting
I am able to provide online help on your computer at a reasonable rate.
I use a Blue condenser Microphone to record my videos, here is the link
Check out Crowdcast for creating your webinars
If you need to buy Office 2019 follow
I use Tube Buddy to help promote my videos
Check them out
Follow me on Facebook
TWEET THIS VIDEO
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.
code for choosing locations
NextCode:
GetFolder = sItem
Set fldr = Nothing
End Function
Sub data()
FilePath = FileSelectBox(“*.xlsx”)
Sheet1.Range(“D4”).Value = FilePath
End Sub
Function FileSelectBox(ByRef FileType As String, Optional ByVal DefaultDir As String) As String
Dim a As Object, filename As String, varFile As Variant
Set a = Application.FileDialog(msoFileDialogFilePicker)
With a
.AllowMultiSelect = False
.Title = “Select File…”
.Filters.Clear
.Filters.Add “Excel Files”, FileType
If Not IsMissing(DefaultDir) And DefaultDir (does not equal) “” Then .InitialFileName = DefaultDir
If .Show = True Then
For Each varFile In .SelectedItems
FileSelectBox = varFile
Next varFile
End If
End With
End Function
Code for filtering data
Sub sortbysales()
Dim dfile As String
Dim row, lastrow As Long
Dim reportsheet As Worksheet
Dim salp, sfile As String
Dim path As String
Dim erow As Long
salp = Sheet1.Range(“C2”).Value
path = Sheet1.Range(“D7”).Value & “”
dfile = Sheet1.Range(“D4”).Value
Set reportsheet = Sheet2
reportsheet.Range(“A1:k1000”).ClearContents
erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).row + 1
Set src = Workbooks.Open(dfile)
row = 2
src.Worksheets(“Sheet4”).Activate
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).row
For row = 2 To lastrow
‘MsgBox src.Worksheets(“Sheet4”).Cells(row, 10).Value
If src.Worksheets(“Sheet4”).Range(“J” & row).Value = salp Then
src.Worksheets(“Sheet4”).Range((“a” & row), (“k” & row)).Copy
ThisWorkbook.Activate
erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).row + 1
Sheet2.Range(“A” & erow).PasteSpecial
GoTo ende
End If
ende:
Next row
src.Close True
‘——————save a file
Sheet2.Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs path & Format(Date, “ddmmmmyyyy”) & salp & “.xlsx”
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.CutCopyMode = False
sfile = path + filename
End Sub
Watch more new videos about Excel Office | Synthesized by Mindovermetal English
Thank you for watching my video. In the code that I provide in the description I am unable to enter the symbol <> there for the symbol is replaced with "not equal to"