Run time error on simple Macro that was working an hour ago

Dantrith

New Member
Joined
Oct 22, 2014
Messages
34
Hi everyone,
I had this macro running fine and I wanted to do some additions to it and then it gave me the 1004 run time error.
So I deleted all the extra and went back to this, which is the original (Previously working!) code but I still get the same error
Is there something that I could have done outside of the code to break vba?

Options Explicit
Sub PrintOPMs()
Dim Sh As Worksheet
Dim i As Integer



For Each Sh In ActiveWorkbook.Worksheets

Sh.PrintOut copies:=Cells(2 + i, 2).Value
i = i + 1

Next Sh


End Sub
 
Which sheet is Cells(2 + i, 2).Value meant to be on?
 
Upvote 0
I don't know what it was before but I added ActiveSheet as well as Worksheets("Reference sheet") just in case and got the same error. It is meant to reference the last sheet in the workbook "Reference sheet"
 
Upvote 0

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