If I create a new workbook, example "combined.xlsx" and attempt to run a macro named "xxx", the macro isn't available until I unhide the Personal.xlsb file, however, when I run the macro it runs(completes the steps of the macro correctly) in the Personal.xlsb file when I intended it to complete the steps of the macro in the "combined.xlsx file.
I would like advice as to how to run it in the "combined.xlsx" file.
Sub azazaz()
Dim SrcPath As String
SrcPath = "C:\test\testing\"
Dim SrcFileName As String
'SrcFileName = Dir(SrcPath & "x*.xlsx")
SrcFileName = Dir("C:\test\testing\" & "x*.xlsx")
Dim Targetws As Worksheet
Dim top As Range
Dim wrkBk As Workbook
Set top = Range("A1")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While SrcFileName <> ""
Set wrkBk = Workbooks.Open(SrcPath & SrcFileName)
For Each Targetws In wrkBk.Sheets
Targetws.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
Cells.ClearFormats
Cells.Select
Cells.EntireColumn.AutoFit
Selection.ClearFormats
ActiveWindow.FreezePanes = False
Range("A1").Select
Next Targetws
Workbooks(SrcFileName).Close
SrcFileName = Dir()
Loop
For Each Targetws In ActiveWorkbook.Sheets
Set tbl = Targetws.ListObjects.Add(xlSrcRange, Targetws.Range("A1").CurrentRegion, , xlYes)
tbl.Name = "tbl" & Targetws.Name
Next Targetws
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
Sub xxx()
Dim SrcPath As String
SrcPath = "C:\test\"
Dim SrcFileName As String
SrcFileName = Dir(SrcPath & "*.xlsx")
Dim Targetws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While SrcFileName <> ""
Workbooks.Open SrcPath & SrcFileName
For Each Targetws In ActiveWorkbook.Sheets
Targetws.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
Next Targetws
Workbooks(SrcFileName).Close
SrcFileName = Dir()
Loop
'Worksheets(1).Delete
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub