Hi all:
I have code Brown to select excel files and copy Range("C11:J34") from sheets (2) to sheet("PL2") of Activeworkbook
Now I want to Brown to select excel files and copy Range("C11:J34") from sheets (2) to sheet("PL2") of Activeworkbook And copy Range("C9:N44") from sheets (4) to sheet("PL4") of Activeworkbook the same time.
How can I do that or could you change somethings of my code belove to do that:
This's my code
Thanks./.
I have code Brown to select excel files and copy Range("C11:J34") from sheets (2) to sheet("PL2") of Activeworkbook
Now I want to Brown to select excel files and copy Range("C11:J34") from sheets (2) to sheet("PL2") of Activeworkbook And copy Range("C9:N44") from sheets (4) to sheet("PL4") of Activeworkbook the same time.
How can I do that or could you change somethings of my code belove to do that:
This's my code
Code:
Sub SUM_WBs() Sheets("PL2").Range("C11:J34").ClearContents
Dim FileNameXls As Variant, i As Integer, wb As Workbook
'ChDir = "C:\Temp\" 'Default directory
FileNameXls = Application.GetOpenFilename(filefilter:="Excel Files, *.xl*", MultiSelect:=True)
If Not IsArray(FileNameXls) Then Exit Sub ' User cancelled
Application.ScreenUpdating = False
For i = LBound(FileNameXls) To UBound(FileNameXls)
Set wb = Workbooks.Open(FileNameXls(i))
wb.Sheets(2).Range("C11:J34").Copy 'Range of cells that needs to be sum
ThisWorkbook.Sheets("PL2").Range("C11:J34").PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
wb.Close SaveChanges:=False
Next i
Application.ScreenUpdating = True
End Sub
Thanks./.