Macro works f8, not when ran..help

S

Soonernut

Have a simple macro, works perfectly when step thru, fails a
highlighted point when ran. I added a timer because I thought th
download process took too long and the macro was continuing before th
file completely downloaded.

Any suggestions?

Thanks in advance.


Sub ANDY()
'
' ANDY Macro
' Macro recorded 6/22/2004 by Administrator
'
' Keyboard Shortcut: Ctrl+Shift+Q
'


Range("a1").Select

ActiveCell.FormulaR1C1 = "=TODAY()"
Range("a1").Select
Selection.NumberFormat = "yyyymmdd"
usedate = Format(Sheets("Sheet1").Cells(1, 2), "YYYYMMDD")
Filename = "ftp://ftp.pjm.com/pub/account/lmp/" & usedate & ".csv"

Workbooks.Open Filename:

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 45
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Cells.Select
Selection.Copy
ActiveWindow.ActivateNext
Sheets("Sheet2").Select
Cells.Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End Su
 
D

Dave Peterson

I didn't see a highlighted point, but I bet it works even if you go through the
tools|macro|macros... dialog. But fails via the shortcut key.

Try getting rid of the shift key from the shortcut.
 

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