home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,780 of 10,840   
   argusy to Steve Gerrard   
   Re: Compile Error   
   11 Dec 05 08:36:02   
   
   From: argusy@slmember.on.net   
      
   Steve   
   He might need a "doevents" in that sort of timer as well   
   Argusy   
      
      
   Steve Gerrard wrote:   
   > "Saxman"  wrote in message   
   > news:px9gfeh9euua$.18vr9g2rs4nq4.dlg@40tude.net...   
   >   
   >>I need to copy/paste in Excel, but with a delay built in between each   
   >>copy/paste operation.   
   >>   
   >>Below is the code which gives me a compile error on the 2nd Sub Delay().   
   >>It is a simple copy from sheet 1 to sheets 2,3,4 and 5.  Can you see   
   >>anything wrong.  Help much appreciated.   
   >   
   >   
   > You can't have three different subs all called Delay. Besides, you don't want   
   > to have to run them all separately.   
   >   
   > You want to first make *one* sub called Delay, and put only the delay code in   
   > it:   
   >   
   > Sub Delay()   
   >  Dim Beg As Long   
   >   
   >  Beg = Timer   
   >  Do   
   >  Loop Until Timer - Beg >= 30   
   >   
   > End Sub   
   >   
   > Then make your main sub, which calls Delay multiple times:   
   >   
   > Sub Macro1()   
   >   
   >     Range("A1:A5").Select   
   >     Selection.Copy   
   >     Sheets("Sheet2").Select   
   >     ActiveSheet.Paste   
   >   
   >     Call Delay   
   >   
   >     Sheets("Sheet1").Select   
   >     Application.CutCopyMode = False   
   >     Selection.Copy   
   >     Sheets("Sheet3").Select   
   >     ActiveSheet.Paste   
   >   
   >     Call Delay   
   >   
   >     ' etc...   
   >   
   > End Sub   
   >   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca