Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with VBA Code?
Can anyone tell me why this isn't working?
Private Sub Workbook_Open() Worksheets("Sheet1").Activate End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Alt Code Problem | Excel Discussion (Misc queries) | |||
code problem | Excel Programming | |||
problem with this code | Excel Programming | |||
vba code problem | Excel Programming | |||
Code Problem ! | Excel Programming |