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

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,778
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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,329
Office Version
  1. 365
Platform
  1. Windows
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.
 

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,778
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,329
Office Version
  1. 365
Platform
  1. Windows
And the error is?
 

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,778
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...
 

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,778
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...
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,327
Messages
5,769,460
Members
425,550
Latest member
Bonebeast

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
Top