Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default If Active Sheet on Opening is X then do Y

Hi, I'm having trouble with the below code. I want the open procedure
to exit the code if the active sheet on opening is "Option1" can
anyone help please??

Private Sub Workbook_Open()
Application.ScreenUpdating = False
If ActiveSheet.Name("Option1") Then
Exit Sub
End If
ActiveWorkbook.Sheets("Input").Activate
If Range("D30") < "" Then
ActiveWorkbook.Sheets("Default").Select
Exit Sub
End If
UserForm2.Show
Application.ScreenUpdating = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default If Active Sheet on Opening is X then do Y

Hi Galimi,

as instructed i entered the debug and the [same as before] following
error appeared : Run-Time Error '451'

Property let procedurenot defined and property get procedure did not
return an object

I'm totally lost....

Scott

galimi wrote:
It may be showing the workbook name as Option1.xls. To verify, put a
debug.print activesheet.name statement in at the very top of your module.
--
http://HelpExcel.com




"spences10" wrote:

Hi, I'm having trouble with the below code. I want the open procedure
to exit the code if the active sheet on opening is "Option1" can
anyone help please??

Private Sub Workbook_Open()
Application.ScreenUpdating = False
If ActiveSheet.Name("Option1") Then
Exit Sub
End If
ActiveWorkbook.Sheets("Input").Activate
If Range("D30") < "" Then
ActiveWorkbook.Sheets("Default").Select
Exit Sub
End If
UserForm2.Show
Application.ScreenUpdating = True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default If Active Sheet on Opening is X then do Y

Gary,

Excellent

Thats the one, Thank You

Gary''s Student wrote:
Private Sub Workbook_Open()
If ActiveSheet.Name = "Option1" Then
MsgBox ("because active sheet is Option1, I am leaving")
Exit Sub
End If
End Sub

--
Gary's Student


"spences10" wrote:

Hi, I'm having trouble with the below code. I want the open procedure
to exit the code if the active sheet on opening is "Option1" can
anyone help please??

Private Sub Workbook_Open()
Application.ScreenUpdating = False
If ActiveSheet.Name("Option1") Then
Exit Sub
End If
ActiveWorkbook.Sheets("Input").Activate
If Range("D30") < "" Then
ActiveWorkbook.Sheets("Default").Select
Exit Sub
End If
UserForm2.Show
Application.ScreenUpdating = True
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
I need to sort an active sheet using the col of the active cell HamFlyer Excel Programming 3 June 6th 06 07:25 PM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Excel Programming 3 January 23rd 06 09:57 PM
Active Cell when opening workbook mwclark0807 Excel Worksheet Functions 3 January 5th 06 04:38 AM
Opening and pasting in active workbook TR[_2_] Excel Programming 3 July 29th 04 02:16 PM
PERSONAL.xls is opening as active when Excel starts - why? TBA[_2_] Excel Programming 2 January 9th 04 08:32 PM


All times are GMT +1. The time now is 01:56 PM.

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

About Us

"It's about Microsoft Excel"