I've tried looking for this everywhere and been unable to find it anywhere.
I have a code where I use a with statement to loop through data, my question is how to loop through while looking only at a specific page called "Report" it's always the first sheet in the worksheet. Here is the coding I have it is not working.
Set TargetFiles = Application.FileDialog(msoFileDialogOpen)
With TargetFiles
.Application.Worksheets(1).Activate
.AllowMultiSelect = True
.Title = "Multi-select target data files:"
.ButtonName = ""
.Filters.Clear
.Filters.Add ".xlsm files", "*.xlsm"
.Show
End With
The part I put in
.Application.Worksheets(1).Activate
isn't doing what I want. Basically this is part of a bigger set of code that loops through a user selected range and copies and pastes to a new workbook, that only works if they were all saved on the correct sheet. I learned the overall coding from this question thread: Copying worksheets from multiple workbooks into current workbook
So there were 2 options as answers (I upvoted both) and both work but I'd like to combine parts of each. One the user picks the sheets but for it to work they all have to be on the correct sheet, on the other you have to have the files saved to a specific folder. I'd like to have the user select option for files but still have them combined based off a specific sheet name "Report" or location like worksheets(1).
Can anyone help with that?