Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 22 Dec 2005 06:35:54 +0800, PY & Associates wrote:
treat each of your modules as subroutines if each of them works by itself, then sub main() for i = 1 to 15 read web subroutine 'just read, do not create new sheets snapshot subroutine 'ditto Sheets("Latest Snapshot").Range("J3:J17").Copy Sheets("Chartdata").Cells(2, i+1).PasteSpecial Paste:=xlPasteValues Application.Wait (Now + TimeValue("0:00:60")) Next i end sub Sub main() For i = 1 To 15 'read web subroutine 'just read, do not create new sheets 'snapshot subroutine 'ditto Sheets("Latest Snapshot").Range("J3:J17").Copy Sheets("Chartdata").Cells(2, i + 1).PasteSpecial Paste:=xlPasteValues Application.Wait (Now + TimeValue("0:00:02")) Next i End Sub The above works fine when tested in a new module. Sometimes when I try to test this, I am prompted for a macro name. How do I assign it a macro name? It might run when incorporated with the main code or placed in a new module? When I paste it into an existing module and test it, I get a Compile Error (Variable not defined @ For i = 1 To 15 ). if you comment out read web and snapshot, change time value to 2 sec, you I have now done that. I am going to office now. send further information to my private address, if you want. I do not keep watching NG all day. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|