Error Handling: on Private Sub during copy sheet...

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,786
Office Version
  1. 2016
Platform
  1. Windows
I'm using this code on each sheet to call another macro, but when I try to copy that sheet to a Book1 I get an error.

I've tried to use On Error Resume Next but must not be using it correctly?

Code

Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
SetFontAeral7_RowAutoFit
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
It might help to see the other code, that's probably where the problem lies.

It might also help to know what the error is.
 
Upvote 0
this is the Public Code:

Sub SetFontAeral7_RowAutoFit()
ActiveSheet.Unprotect
Application.ScreenUpdating = False
Rows("3:248").Select
Range(Selection, Selection.End(xlDown)).Select
With Selection.Font
.Name = "Arial"
.Size = 7
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
Selection.Rows.AutoFit
Range("I1").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=False
Application.ScreenUpdating = True
End Sub

Private Sub:

Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
SetFontAeral7_RowAutoFit
Application.ScreenUpdating = True
End Sub
 
Upvote 0
forgot

Compile Error

Sub or Function not defined

It is generated on the new book that is created because the sub is not in that book--it's in the book that the sheet was copied from, gut that coode is not needed in the new book...
 
Upvote 0
Straightening up previous post--LAN problems

Compile Error
Sub or Function not defined

It is generated on the new book that is created because the sub is not in that book--it's in the book that the sheet was copied from, but that coode is not needed in the new book...
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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