StellaArtois
New Member
- Joined
- Jan 10, 2024
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
Hi all i have a code that searches data from a list of workbooks found in a folder
The data is copeied and pasted into a column i can utilise for reporting
this works well? But....
Is there a way to manipulate the filepath to look for workbooks within the main folder and any folders within the main folder
The data is copeied and pasted into a column i can utilise for reporting
this works well? But....
Is there a way to manipulate the filepath to look for workbooks within the main folder and any folders within the main folder
Code:
Sub Update_Backorders()
Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim FldrPicker As FileDialog
Dim rng As Range
'myPath = "\\dta01\AftService\shops\Admin\Parts & Materials\Parts Lists WIP\Other\"
myPath = "C:\Users\uknown\Desktop\WIP\Main\"
myExtension = "*.xls"
myFile = Dir(myPath & myExtension)
Set rng = ThisWorkbook.Sheets("Other").Range("C3")
x = 0
Do While myFile <> ""
Set wb = Workbooks.Open(Filename:=myPath & myFile)
wb.Worksheets(1).Range("ET16:FL512").Copy
ThisWorkbook.Sheets("Other").Activate
rng.Offset(x).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Set Copiedrng = Selection
For Each cell In Copiedrng.Columns(1).Cells
yy = cell.Address
If cell.Value = "" Then
RowLength = cell.Row
Exit For
End If
Next cell
x = RowLength - rng.Row + 0
wb.Close SaveChanges:=False
myFile = Dir
Loop
Range("A1").Select
Sheets("Report").Select
Range("A1").Select
Call Calculation_Automatic
End Sub
[code/]