Home > Software engineering >  By VBA under different folders, open the excel file, and will be part of copy summary to a new table
By VBA under different folders, open the excel file, and will be part of copy summary to a new table

Time:09-19

Everyone a great god, and I hope to Open the excel file under different folders, and will be part of copy summary to a new table, but to the "Application. Workbooks. Open Filename:=myfile & amp; Sheets (hereinafter referred to as "company"). The Cells (3, 3) & amp; "\ companies report " & amp; Cells (n, 1) & amp; "\ *. XLSX" "always prompt" method is applied to object workbooks open when the failure ", the code is as follows, a great god please help guide, thank you!

Private Sub Workbook_BeforeClose (Cancel As Boolean)
Application. ScreenUpdating=False
On the Error Resume Next
Application. The SendKeys "{ENTER}" ENTER
End Sub
Sub abnormal expiration ()
For n=2 To 25
I=n - 1
Myfile.=ThisWorkbook Path & amp; ""
Application. The Workbooks. Open Filename:=myfile & amp; Sheets (hereinafter referred to as "company"). The Cells (3, 3) & amp; "\ companies report " & amp; Cells (n, 1) & amp; "\ *. XLSX
"Sheets (" table 1-4 expiration of abnormal payment "). Select
Range (" A1: J15). Select
Selection. Copy
ActiveWindow. Close False
Windows (" VBA tables. XLSM "). The Activate
Sheets. The Add After:=ActiveSheet
ActiveSheet. Paste
Selection. The PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets (I). Select
Sheets (I). The Name=Sheets (hereinafter referred to as "company"). The Range (B & amp; N)
Next
End Sub

CodePudding user response:

Qq656972278 can remote debugging, the limit of night, online, estimated at about 10 a.m.

CodePudding user response:

Began keeping records in Excel macro, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,
  •  Tags:  
  • VBA
  • Related