Run Time Error in Macro

TooZippy

Board Regular
Joined
Dec 30, 2018
Messages
70
I have this macro in two different files. It runs in the first one but when I run it in the second one I get a "Run Time Error" message asking me to debug. I moved things around in the print area and this error message came up when I ran the macro. It was working fine before I moved things around.

I changed the row numbers in the macro to correspond to where it is supposed to print out after I moved things around. In the second file I have a formula that pulls the number printed out from the first file and adds to it the number printed out in this file. Here is the macro...
Rich (BB code):
Sub PrintCheck()
'
' CheckPrinting Macro
'
   Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")
   Dim num As Integer
   Range("N8, N28, N46").Select
   num = Range("N8, N28, N46").Value
   num = num + 1
   Range("N8, N28, N46").Value = num


End Sub

The line in the code that I made bold is the area that shows up yellow in the macro when I go to debug.

Thank you,
 
Last edited by a moderator:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
What is the actual error message?
 
Upvote 0
RoryA Thank you for responding to my question. I got some help outside of MrExcel that solved my problem. When I moved the cells in the print area I did not change the format from Locked to Hidden so when I protected the sheet the macro could not complete the instructions. Thank you anyway. TooZippy
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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