please help, macro stops after opening a sheet

shackbully

New Member
Joined
Oct 24, 2004
Messages
7
this macro stops at the beginning of the fourth line, after it opens the p2_report file. it will step through fine, and it works fine if the deyboard shortcut is ctrl+j. it is always run in the file it was written.

been working on this for too long.

thanks for the help



' Keyboard Shortcut: Ctrl+Shift+j
'
Range("AP61:AY113").Select
Selection.Copy
Workbooks.Open Filename:="c:\p2_daily\p2_report.xls"
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:="C:\p2_daily\Morningreports\p2_daily" & Format(Date, "YYMMDD") - 1 & Op & ".xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close
Range("AP54").Select
End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You just have not told the macro where to paste the copied data.

Insert a line before the 4th Line (paste.......)
Then write the code to position the cursor at the cell you wish to paste the copied data where xx is the cell address (not the range just the start cell).

range("XX").select
 
Upvote 0

Forum statistics

Threads
1,203,521
Messages
6,055,883
Members
444,830
Latest member
Excelsmallbusinessmom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top