Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy/Paste Revisted
I have finally got the following code (copy/paste from one worksheet to
another in the same workbook) to run, by including a call statement in the main code...... Call My_Copy -------------------------------------------- Sub My_Copy() For i = 2 To 17 Sheets("Latest Snapshot").Range("J3:J17").Copy Sheets("Chartdata").Cells(2, i).PasteSpecial Paste:=xlPasteValues Application.Wait (Now + TimeValue("0:00:50")) Next i End Sub ----------------------------------------------------------- However, this runs all the time and copy/pastes every 50 seconds until condition 15 is satified. It also uses a lot of resources, thus interfering with the running of the main code. Could I get the above to 'turn off' until the second request and so on is required? I'm thinking of a the following statements:- Select Case For...Next For Each Loop Do Until LoopWhile...Wend Loop Early Exit Loop Or maybe resorting to the following long hand code renaming each copy/paste as a different sub routine and call upon each one in turn? Is this possible and how could I achieve this? Sorry to sound dumb, but I'm only beginner! TIA --------------------------------------------------------------------- Option Explicit Dim i As Integer Sub My_Copy() Sheets("Latest Snapshot").Select Range("J3:J17").Select Selection.Copy Sheets("Chartdata").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Latest Snapshot").Select Range("J3:J17").Select Application.CutCopyMode = False Selection.Copy Sheets("Chartdata").Select Range("C2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Latest Snapshot").Select Application.CutCopyMode = False Selection.Copy Sheets("Chartdata").Select Range("D2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Nested IF function Revisted | Excel Worksheet Functions | |||
Nearly There! (Revisted) | Excel Programming | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming |