austinandreikurt
Board Regular
- Joined
- Aug 25, 2020
- Messages
- 91
- Office Version
- 2016
- Platform
- Windows
I need some help on how to code. I have several files to consolidate into one file. And this will be thru the Workbooks.Open method and each file consist of different sheets that may or may not exist on the other files. Say for example I have Sheets("F1") in the workbook1; Sheets("F1") and Sheets("IG") in workbook2; and Sheets("F2") and Sheets("ENS") in workbook2. So when they consolidate, the consoworkbook should consist of 4 tabs namely Sheets("F1"), Sheets("F2"), Sheets("IG") and Sheets("ENS"). Below is what I have coded for now but haven't organized my thought on how to fully construct the consolidation.
I know this is a bit disorganized and would really appreciate your help on this. Thanks!
VBA Code:
Dim my_FileName As Variant
my_FileName = Application.GetOpenFilename(FileFilter:="Excel Files,*.xls*")
If my_FileName <> False Then
Workbooks.Open Filename:=my_FileName
wbook = ActiveWorkbook.Name
End If
For ???
On Error GoTo NextSheet
WorksheetExists = (ActiveWorkbook.Sheets(WorkSheetName).Name <> "")
Next
NextSheet:
Resume Next
I know this is a bit disorganized and would really appreciate your help on this. Thanks!