Re: VBA to open another workbook, run macros and run macros in it?
Thanks for the above, I have got it working thanks, however I now run into a "Run Time Error 7: Out of Memory"
Is there a fix for this? Here is the full code that I am using, and start by running the "run" macro from workbook book1.
Sub run() strFile = Application.GetOpenFilename Application.Workbooks.Open (strFile) With ActiveWorkbook Application.run "'Book1.xlsm'!runcleanholden" End With End Sub Sub cleanholden() Range("A:A,B:B,D:D,E:E,F:F,G:G,H:H,N:N,O:O,P:P,Q:Q,R:R,S:S,U:U,V:V,W:W,X:X").Select Selection.Delete Shift:=xlToLeft With Range("D:D") .NumberFormat = "General" .Value = .Value End With With Range("E:E") .NumberFormat = "General" .Value = .Value End With With Range("F:F") .NumberFormat = "General" .Value = .Value End With Cells.Select Cells.EntireColumn.AutoFit Selection.RowHeight = 15 Rows("1:1").Select Selection.Delete Shift:=xlUp End Sub Sub runcleanholden() Application.ScreenUpdating = False Dim wSheet As Worksheet For Each wSheet In ActiveWorkbook.Worksheets wSheet.Activate Application.run "'Book1.xlsm'!cleanholden" Next wSheet Application.ScreenUpdating = True MsgBox ("Completed") End Sub