Maestroso

New Member
Joined
Jul 20, 2015
Messages
1
Hi all,

I have a problem making my program open on a specific worksheet, as I get a 1004 error and the text "Method activation of class Worksheet error". This only happens when I put my code in a Workbook_Open sub like this:

Code:
Sub Workbook_Open()
With Application
    .DisplayFullScreen = True
    .DisplayFormulaBar = False
    .Calculation = xlAutomatic
End With
ThisWorkbook.Worksheets("General Data").Activate
Range("D3").Select
End Sub

However when I use it in a normal way, I have no problem going to that specific worksheet and Range:

Code:
Sub GotoGeneralData()
Worksheets("General Data").Activate
Range("D3").Select
End Sub

Does anyone know why I get this error? I have been looking all over the web for explanations, but most of them concerned copy/paste codes, so I figured that wasn't what I'm looking for. Thanks in advance.

PS.
I'm not sure if I posted the code correctly this way, this is my first thread on this forum. If anything's wrong with this post, please let me know
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi and welcome to the MrExcel Message Board,

I tried your code and it worked OK for me. No errors.
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,689
Members
449,329
Latest member
tommyarra

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