ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy & Paste Macro optimize (https://www.excelbanter.com/excel-programming/300970-copy-paste-macro-optimize.html)

the_xox

Copy & Paste Macro optimize
 
Hi..

Thanks for all your help....i have this macro ....


Sub Macro1(name As String)
Workbooks.Open Filename:=name
Range("G7").Select
Selection.Copy
Windows("target.xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone
SkipBlanks _
:=False, Transpose:=False

Windows(name).Activate
Range("G8").Select
Selection.Copy
Windows("target.xls").Activate
ActiveCell.Next.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False

Windows(name).Activate
Range("G10").Select
Selection.Copy
Windows("target.xls").Activate
ActiveCell.Next.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False

Windows(name).Activate
Range("F2").Select
Selection.Copy
Windows("target.xls").Activate
ActiveCell.Next.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(rowOffset:=1, columnOffset:=-3).Activate
Workbooks(name).Close SaveChanges:=False
End Sub

Sub Macro2()
Macro1 "Office_1.xls"
Macro1 "Office_2.xls"

the_xox[_2_]

Copy & Paste Macro optimize
 
HI all.. Thanx for your help.!!!!

The "name" is a file for each office "South_Office.xls
North_Office.xls, ...up to 8 files), the target range is "C3:G3"... an
paste data in one row :

"Target.xls"

-A---B----------------C-------D-------E------G-
01--South_Office----"G7"-----"G8"----"G10"---"F2"
01--North_Office----"G7"-----"G8"----"G10"---"F2"
01--Central_Office--"G7"-----"G8"----"G10"---"F2"


All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com