Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default VB Macro for Excel

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default VB Macro for Excel

http://www.rondebruin.nl/ado.htm#Functions

use Ron's GetData Function to quickly get information from closed workbooks

also to speed up and avoid screen flash:

Application.screenupdating = False
'your code
Application.ScreenUpdating = True


"furbiuzzu" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM


All times are GMT +1. The time now is 09:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"