Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Problem with VBA Code?

Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Problem with VBA Code?

Hi Steve

three ideas
1) you don't have a sheet called Sheet1
2) macros are not enabled (tools / macro /security - set to medium - choose
enable macros when asked)
3) it's not in the ThisWorkbook module of the workbook

Cheers
JulieD

"Steve" wrote in message
...
Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Problem with VBA Code?

There shouldn't be anything wrong with this code unless you have renamed
Sheet1 to some other name e.g. "NewName". If so you will have to change it
as follows:

Private Sub Workbook_Open()
Worksheets("NewName").Activate
End Sub

Regards,

Alasdair Stirling
"Steve" wrote:

Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Problem with VBA Code?

I beleive that Application Events can only be handled from class modules.

You should be able to find the solution to your problem if you search for
"Application Events" in the VBA help, and find an article relating to,
"Using events with the application object."

Hope that helps.

-Mike

"Steve" wrote in message
...
Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problem with VBA Code?

Assume you have Workbook_Open code you show in the ThisWorkbook module and
you have a sheet named Sheet1 in that workbook, then you might try the
following:

Private Sub Workbook_Open()
Thisworkbook.Worksheets("Sheet1").Activate
End Sub

--
Regards,
Tom Ogilvy

"Steve" wrote in message
...
Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problem with VBA Code?

That isn't an application level event. It is a workbook level event.

--
Regards,
Tom Ogilvy

"Mike Mertes" wrote in message
...
I beleive that Application Events can only be handled from class modules.

You should be able to find the solution to your problem if you search for
"Application Events" in the VBA help, and find an article relating to,
"Using events with the application object."

Hope that helps.

-Mike

"Steve" wrote in message
...
Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Problem with VBA Code?

My mistake, you're right.

I was confusing it with the app_WorkbookOpen event.

-Mike

"Tom Ogilvy" wrote in message
...
That isn't an application level event. It is a workbook level event.

--
Regards,
Tom Ogilvy

"Mike Mertes" wrote in message
...
I beleive that Application Events can only be handled from class

modules.

You should be able to find the solution to your problem if you search

for
"Application Events" in the VBA help, and find an article relating to,
"Using events with the application object."

Hope that helps.

-Mike

"Steve" wrote in message
...
Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Problem with VBA Code?

Guys I apologize. That is twice today I have had my head buried in a dark
hole. Everyonce in a while my excel here at work resets the Macro security
to high. That was the problem. Sorry for your wasting your time. But i do
appreciate the Quick and multiple responses. Thanks Guys and Gals.

Steve

"Steve" wrote:

Can anyone tell me why this isn't working?

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alt Code Problem aftamath77 Excel Discussion (Misc queries) 2 February 10th 09 11:42 PM
code problem scrabtree23[_2_] Excel Programming 2 September 16th 04 05:28 AM
problem with this code Travis Excel Programming 1 January 28th 04 05:43 PM
vba code problem Steve Excel Programming 3 November 26th 03 10:51 AM
Code Problem ! Mike R Excel Programming 5 August 5th 03 03:35 PM


All times are GMT +1. The time now is 03:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"