VB Macro for Excel

F

furbiuzzu

Hi all, i've a little problem.
i've to copy data from one file to its updated version.
let's say:
My.T.y.M.xls is the new file (the one to be updated)
My.T.y.M2.xls is the old file (from which i want to copy data)

how is it possible to copy data recorded in non-adiacent cell in a
quick way???

At the moment i've written a macro that works fine but it's not written
in the best way, can someone help me please ??

i would like to avoid the macro to jump from one file to the other one
changing program lines such as (see macro list below):

Windows("My.T.y.M2.xls").Activate
copy cell content
Windows("My.T.y.M2.xls").Activate
paste cell content

with a more compact instruction.

below you've the macro i use.

Sub copiaform_da_MytyM2_a_MytyM()
'
' copiaform_da_MytyM2_a_MytyM Macro
' Macro registrata il 19/10/2005 da fulvio
Dim i As Integer

For i = 15 To 123 Step 12

Windows("My.T.y.M2.xls").Activate
Sheets("saved line-ups").Select
Range("B" & i).Select
Application.CutCopyMode = False
selection.Copy

Windows("My.T.y.M.xls").Activate
Sheets("saved line-ups").Select
Range("B" & i).Select
selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Windows("My.T.y.M2.xls").Activate
Sheets("saved line-ups").Select
Range("C" & i + 1 & ":C" & i + 11).Select
Application.CutCopyMode = False
selection.Copy

Windows("My.T.y.M.xls").Activate
Sheets("saved line-ups").Select
Range("C" & i + 1 & ":C" & i + 11).Select
selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Windows("My.T.y.M2.xls").Activate
Sheets("saved line-ups").Select
Range("E" & i + 1 & ":E" & i + 11).Select
Application.CutCopyMode = False
selection.Copy

Windows("My.T.y.M.xls").Activate
Sheets("saved line-ups").Select
Range("E" & i + 1 & ":E" & i + 11).Select
selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Next i
Range("A1").Select
Sheets("My T.y.M's infos").Select
Range("R197").Select

End Sub

thanks for your help
 

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