2nd Copy/Paste not working in VBA Code

dmartin72724

New Member
Joined
Jun 12, 2017
Messages
2
Hello - first time poster, long time reader. I am having difficulty with the second copy/paste functionality in a macro. Basically, when a 'complete' button is hit, the macro should copy from sheet A and past on sheet C, and then copy sheet B and paste on sheet B. Pretty basic stuff. This macro stopped working about a week ago and I cant figure out why! It worked for about 15 days, then has not since.

I have basic to intermediate knowledge of VBA and the current excel project is my largest project by far. I have about 30 macros doing various things. Anyway, would love any suggestions, and thanks for your assistance.

First I tried:

Sub Paste_Recon_Final_Data()
Application.ScreenUpdating = False

Worksheets("EqyData").Range("A3:Z1000").Clear
Worksheets("SwapData").Range("A3:Z1000").Clear

Worksheets("Eqy Pos-Prime").Range("A2:Z1000").Copy

With Sheets("EqyData")
.Range("A3").PasteSpecial xlPasteValues
.Range("A3").Select​
End With

Worksheets("Swap Pos-Prime").Range("A2:AV1000").Copy

With Sheets("SwapData")
.Range("A3").PasteSpecial xlPasteValues
.Range("A3").Select​
End With

Application.CutCopyMode = False
ActiveWorkbook.RefreshAll
Application.ScreenUpdating = True


MsgBox "Recon Macro is complete"​


End Sub


Then I tried inserting Application.CutCopyMode = False in between the two copies. That didnt work.

Then I tried it the same, but different way:

Sub testCompleteRecon

Worksheets("EqyData").Range("A3:AZ1000").Clear
Worksheets("Eqy Pos-Prime").Range("A2:Z1000").Copy
Worksheets("EqyData").Range("A3").PasteSpecial xlPasteValues

Worksheets("SwapData").Range("A3:AV1000").Clear
Worksheets("Swap Pos-Prime").Range("A2:AV1000").Copy
Worksheets("SwapData").Range("A3").PasteSpecial xlPasteValues

Application.CutCopyMode = False
ActiveWorkbook.RefreshAll
Application.ScreenUpdating = True​
MsgBox "Recon Macro is complete"​

End Sub


I also tried the Application.CutCopyMode = False in between both copies.

The third was to separate the code into two macros and run them in 1 macro. I recorded it and noticed again that Excel recorder put "Application.CutCopyMode = False" in between the two macros. I tried both with and without this, and it did not work when I ran it again.

What gives? And thanks in advance for your help!







****** id="cke_pastebin" style="position: absolute; top: 600px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> Application.CutCopyMode = False
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Also, forgot to note that when I separated the two macros, they work when run manually one after the other. The macro to run both wont work.
 
Upvote 0

Forum statistics

Threads
1,223,974
Messages
6,175,739
Members
452,667
Latest member
vanessavalentino83

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