Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Runtime error 9

Hi,

When opening my Excel WB and enable macros I get the following message:

Runtime error 9
Subscript Out Of Range

I do not get any possibility to debug, only to END the message window.
Previously I changed the tab names, but I changed them in the macros as well
and after having checked them several time, I cannot find any error.
Otherwise, I cannot explain the message window, also because once I have
clicked END, all the macros seem to work perfectly.

Any idea?

Thanks
Alex
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Runtime error 9

I am guessing that you have an on_open macro in the workbook somewhere? Have
you tried stepping through that code one line at a time? I am guessing that
the problem is somewhere in there...

HTH

"Metallo" wrote:

Hi,

When opening my Excel WB and enable macros I get the following message:

Runtime error 9
Subscript Out Of Range

I do not get any possibility to debug, only to END the message window.
Previously I changed the tab names, but I changed them in the macros as well
and after having checked them several time, I cannot find any error.
Otherwise, I cannot explain the message window, also because once I have
clicked END, all the macros seem to work perfectly.

Any idea?

Thanks
Alex

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Runtime error 9

Alex,

First - it's possibly macro refers to another workbook,
Second - macro create by another user and project have
password - disable debug
Regards
Mark

-----Original Message-----
Hi,

When opening my Excel WB and enable macros I get the

following message:

Runtime error 9
Subscript Out Of Range

I do not get any possibility to debug, only to END the

message window.
Previously I changed the tab names, but I changed them in

the macros as well
and after having checked them several time, I cannot find

any error.
Otherwise, I cannot explain the message window, also

because once I have
clicked END, all the macros seem to work perfectly.

Any idea?

Thanks
Alex
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Runtime error 9

Hi,

This is the code, I cannot find anything strange in it.
Please, have a look yourself.

QUOTE
Option Explicit

Dim arySheets

Private Sub Workbook_Open()

'''Enable Outlining navigation and protect everything on the sheet with
UserInterfaceOnly.
Sheets("2003").EnableOutlining = True
Sheets("2003").Protect Password:="psw", UserInterfaceOnly:=True
Sheets("Reduction Target 2004_05").EnableOutlining = True
Sheets("Reduction Target 2004_05").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("2005 Target").EnableOutlining = True
Sheets("2005 Target").Protect Password:="psw", UserInterfaceOnly:=True
Sheets("2005 Act").EnableOutlining = True
Sheets("2005 Act").Protect Password:="psw", UserInterfaceOnly:=True
Sheets("2005 Comp to 2003").EnableOutlining = True
Sheets("2005 Comp to 2003").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("2005 Comp to 2003_ Volume Only").EnableOutlining = True
Sheets("2005 Comp to 2003_ Volume Only").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff of 2005 Comp, to 2003").EnableOutlining = True
Sheets("Diff of 2005 Comp, to 2003").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff of 2005 Comp, to 2005 Tgt ").EnableOutlining = True
Sheets("Diff of 2005 Comp, to 2005 Tgt ").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff of 2005 Comp_VO, to 2003").EnableOutlining = True
Sheets("Diff of 2005 Comp_VO, to 2003").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff 2005 Comp_VO, to 2005 Tgt").EnableOutlining = True
Sheets("Diff 2005 Comp_VO, to 2005 Tgt").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Macros").Protect Password:="psw"
Sheets("Glossary").Protect Password:="psw"
Sheets("DB").Protect Password:="psw"
Sheets("DB_VO").Protect Password:="psw"
Charts("Chart3").Protect Password:="psw"
Charts("Chart4").Protect Password:="psw"

End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim oSheet As Worksheet

On Error GoTo ws_exit:
arySheets = Array("2003", "Reduction Target 2004_05", "2005 Target",
"2005 Act", "2005 Comp to 2003", "2005 Comp to 2003_ Volume Only", "Diff of
2005 Comp, to 2003", "Diff of 2005 Comp, to 2005 Tgt ", "Diff of 2005
Comp_VO, to 2003", "Diff 2005 Comp_VO, to 2005 Tgt", "DB", "DB_VO")
Application.EnableEvents = False
If SheetInArray(Sh.Name) Then
If Target.Address = "$B$5" Then
With Target
If .Value = 1 And .Value <= 12 Then
For Each oSheet In ActiveWorkbook.Worksheets
If oSheet.Name < Sh.Name And
SheetInArray(oSheet.Name) Then
If oSheet.ProtectContents Then
oSheet.Unprotect Password:="psw"
oSheet.Range("B5").Value = .Value
oSheet.Protect Password:="psw"
Else
oSheet.Range("B5").Value = .Value
End If
End If
Next oSheet
Else
MsgBox .Value & " is an invalid value"
.Value = ""
End If
End With
End If
End If

ws_exit:
Application.EnableEvents = True

End Sub

Private Function SheetInArray(Name As String)
Dim fSheet As Boolean
Dim i As Long
fSheet = False
For i = LBound(arySheets, 1) To UBound(arySheets, 1)
If arySheets(i) = Name Then
fSheet = True
Exit For
End If
Next i
SheetInArray = fSheet

End Function

/QUOTE

Thanks
Alex

"Mark" wrote:

Alex,

First - it's possibly macro refers to another workbook,
Second - macro create by another user and project have
password - disable debug
Regards
Mark

-----Original Message-----
Hi,

When opening my Excel WB and enable macros I get the

following message:

Runtime error 9
Subscript Out Of Range

I do not get any possibility to debug, only to END the

message window.
Previously I changed the tab names, but I changed them in

the macros as well
and after having checked them several time, I cannot find

any error.
Otherwise, I cannot explain the message window, also

because once I have
clicked END, all the macros seem to work perfectly.

Any idea?

Thanks
Alex
.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Runtime error 9

Hi,

Can anybody help?

Thank you
ALex

"Metallo" wrote:

Hi,

This is the code, I cannot find anything strange in it.
Please, have a look yourself.

QUOTE
Option Explicit

Dim arySheets

Private Sub Workbook_Open()

'''Enable Outlining navigation and protect everything on the sheet with
UserInterfaceOnly.
Sheets("2003").EnableOutlining = True
Sheets("2003").Protect Password:="psw", UserInterfaceOnly:=True
Sheets("Reduction Target 2004_05").EnableOutlining = True
Sheets("Reduction Target 2004_05").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("2005 Target").EnableOutlining = True
Sheets("2005 Target").Protect Password:="psw", UserInterfaceOnly:=True
Sheets("2005 Act").EnableOutlining = True
Sheets("2005 Act").Protect Password:="psw", UserInterfaceOnly:=True
Sheets("2005 Comp to 2003").EnableOutlining = True
Sheets("2005 Comp to 2003").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("2005 Comp to 2003_ Volume Only").EnableOutlining = True
Sheets("2005 Comp to 2003_ Volume Only").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff of 2005 Comp, to 2003").EnableOutlining = True
Sheets("Diff of 2005 Comp, to 2003").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff of 2005 Comp, to 2005 Tgt ").EnableOutlining = True
Sheets("Diff of 2005 Comp, to 2005 Tgt ").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff of 2005 Comp_VO, to 2003").EnableOutlining = True
Sheets("Diff of 2005 Comp_VO, to 2003").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Diff 2005 Comp_VO, to 2005 Tgt").EnableOutlining = True
Sheets("Diff 2005 Comp_VO, to 2005 Tgt").Protect Password:="psw",
UserInterfaceOnly:=True
Sheets("Macros").Protect Password:="psw"
Sheets("Glossary").Protect Password:="psw"
Sheets("DB").Protect Password:="psw"
Sheets("DB_VO").Protect Password:="psw"
Charts("Chart3").Protect Password:="psw"
Charts("Chart4").Protect Password:="psw"

End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim oSheet As Worksheet

On Error GoTo ws_exit:
arySheets = Array("2003", "Reduction Target 2004_05", "2005 Target",
"2005 Act", "2005 Comp to 2003", "2005 Comp to 2003_ Volume Only", "Diff of
2005 Comp, to 2003", "Diff of 2005 Comp, to 2005 Tgt ", "Diff of 2005
Comp_VO, to 2003", "Diff 2005 Comp_VO, to 2005 Tgt", "DB", "DB_VO")
Application.EnableEvents = False
If SheetInArray(Sh.Name) Then
If Target.Address = "$B$5" Then
With Target
If .Value = 1 And .Value <= 12 Then
For Each oSheet In ActiveWorkbook.Worksheets
If oSheet.Name < Sh.Name And
SheetInArray(oSheet.Name) Then
If oSheet.ProtectContents Then
oSheet.Unprotect Password:="psw"
oSheet.Range("B5").Value = .Value
oSheet.Protect Password:="psw"
Else
oSheet.Range("B5").Value = .Value
End If
End If
Next oSheet
Else
MsgBox .Value & " is an invalid value"
.Value = ""
End If
End With
End If
End If

ws_exit:
Application.EnableEvents = True

End Sub

Private Function SheetInArray(Name As String)
Dim fSheet As Boolean
Dim i As Long
fSheet = False
For i = LBound(arySheets, 1) To UBound(arySheets, 1)
If arySheets(i) = Name Then
fSheet = True
Exit For
End If
Next i
SheetInArray = fSheet

End Function

/QUOTE

Thanks
Alex

"Mark" wrote:

Alex,

First - it's possibly macro refers to another workbook,
Second - macro create by another user and project have
password - disable debug
Regards
Mark

-----Original Message-----
Hi,

When opening my Excel WB and enable macros I get the

following message:

Runtime error 9
Subscript Out Of Range

I do not get any possibility to debug, only to END the

message window.
Previously I changed the tab names, but I changed them in

the macros as well
and after having checked them several time, I cannot find

any error.
Otherwise, I cannot explain the message window, also

because once I have
clicked END, all the macros seem to work perfectly.

Any idea?

Thanks
Alex
.




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
xpath error? Runtime Error 13 type mismatch SteveM Excel Discussion (Misc queries) 1 December 4th 07 09:16 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


All times are GMT +1. The time now is 10:27 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"