Problem executing multiple cut and paste operations in VBA

stacyg

New Member
Joined
Sep 28, 2015
Messages
15
I have a workbook with 40 or so tabs in it. 30 of the tabs are for scorecards and 10 are for feeder data and charts. The workbook is essentially a Supplier Scorecard. The code I wrote gives me no compile errors, however it is not changing all of the sheets. I am fairly new to VBA so I am sure it is me not understanding my error, but with no error message its hard to define.

Essentially I want to take the results in AJ1:AT17 and paste special values into AI1:AS17 (moves the data over a month for context).

Also note that I have formulas in column AT that I need to leave as an FYI after the copy and paste function is complete.


Sub Copyandpastetbleover1month()
Worksheets("AGD").Activate
Worksheets("DevaDDD").Activate
Worksheets("Ame").Activate
Worksheets("Axidr").Activate
Worksheets("BD").Activate
Worksheets("CC").Activate
Worksheets("Chdler Ar").Activate
Worksheets("Circr").Activate
Worksheets("Crtion").Activate
Worksheets("Dynamic").Activate
Worksheets("Epo").Activate
Worksheets("Fu").Activate
Worksheets("Linear").Activate
Worksheets("IBX").Activate
Worksheets("IKM").Activate
Worksheets("JIT").Activate


Range("AJ1:AT17").Copy Range("AI1")

End Sub

Sub PasteValues()
Worksheets("AGD").Activate
Worksheets("DevaDDD").Activate
Worksheets("Ame").Activate
Worksheets("Axidr").Activate
Worksheets("BD").Activate
Worksheets("CC").Activate
Worksheets("Chdler Ar").Activate
Worksheets("Circr").Activate
Worksheets("Crtion").Activate
Worksheets("Dynamic").Activate
Worksheets("Epo").Activate
Worksheets("Fu").Activate
Worksheets("Linear").Activate
Worksheets("IBX").Activate
Worksheets("IKM").Activate
Worksheets("JIT").Activate

With Range("AI1:AS17")
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Never mind, I finally found the error and corrected it myself and it now works. Thanks anyway!
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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