I have 4 Sheets where it must not be renamed/touched ...
the name is ... "Menu" / "Original" / "Original (2)" / "UTP"
I have to import multiple ".csv" worksheet and rename accordingly to identify them using the macro below
This is my code to identify the sheets which is imported using the file extension only in the folder ...
This is my file extension to import the data into the workbook.
".csv" file extension
".xls" file extension
When I tried to retrieve some work books with the same extension it doesn't helps me rename them accordingly ...
Hope someone can help me resolve my problem
the name is ... "Menu" / "Original" / "Original (2)" / "UTP"
I have to import multiple ".csv" worksheet and rename accordingly to identify them using the macro below
This is my code to identify the sheets which is imported using the file extension only in the folder ...
Code:
Sub SheetIdentifier()
Dim lastcolumn As Long
lastcolumn = Cells(1, Columns.Count).End(xlToLeft).Column
If lastcolumn = 2 Then ActiveSheet.Name = "Tester Utilization"
If lastcolumn = 20 Then ActiveSheet.Name = "Lot History"
If lastcolumn = 12 Then ActiveSheet.Name = "Lot Operation Report"
End Sub
This is my file extension to import the data into the workbook.
".csv" file extension
Code:
Sub GetNewSheetCSVFile()Path = "C:\Users\momo\Desktop\Chip Fab\"
Filename = Dir(Path & "*.CSV")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
".xls" file extension
Code:
Sub GetNewSheetXLSFile()Path = "C:\Users\momo\Desktop\Chip Fab\"
Filename = Dir(Path & "*.xls")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
When I tried to retrieve some work books with the same extension it doesn't helps me rename them accordingly ...
Code:
Sub RunGetReport()
Call GetNewSheetCSVFile
Call SheetIdentifier
Call SheetIdentifier
Call GetNewSheetXLSFile
Call SheetIdentifier
Call UTPRedirect
End Sub
Hope someone can help me resolve my problem