Copy & Paste Macro optimize

T

the_xox

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"
 
T

the_xox

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top