Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-2008, 04:40 PM
Ben
 
Posts: n/a
Runtime Error '9' - Subscript Out of Range

We have 5 spreadsheet which reside on a network drive. The
spreadsheets are macro driven, and we have issue that only the person
who setup the macro's is able to run them. For everyone else, we
receive Runtime Error '9'. We have tried copying to local drive, and
same issue. Only the creater of the macro's can run them, and this
person is leaving the company. They are unable to figure this out.

When I receive error and click Debug...it goes to following location
in the macro:

For i = 0 To NumOfLeads 'adjust TL's sheets
Windows(PageName(i)).Activate (THIS LINE IS HIGHLIGHTED
YELLOW)
For j = 1 To 4
Worksheets(Sheets(j).Name).Activate
Rows(CopyValue).Copy
Rows(RNValue).Select
Selection.Insert Shift:=xlDown
Next j
Next i

Any ideas what cause might be? We all have same version of
Excel....and same version of VB.
Reply With Quote
  #2 (permalink)  
Old 07-21-2008, 04:47 PM
Dave Peterson
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

What's in pagename()?

If it's just the name of the workbooks, does it include the extension (like
..xls)?



Ben wrote:
>
> We have 5 spreadsheet which reside on a network drive. The
> spreadsheets are macro driven, and we have issue that only the person
> who setup the macro's is able to run them. For everyone else, we
> receive Runtime Error '9'. We have tried copying to local drive, and
> same issue. Only the creater of the macro's can run them, and this
> person is leaving the company. They are unable to figure this out.
>
> When I receive error and click Debug...it goes to following location
> in the macro:
>
> For i = 0 To NumOfLeads 'adjust TL's sheets
> Windows(PageName(i)).Activate (THIS LINE IS HIGHLIGHTED
> YELLOW)
> For j = 1 To 4
> Worksheets(Sheets(j).Name).Activate
> Rows(CopyValue).Copy
> Rows(RNValue).Select
> Selection.Insert Shift:=xlDown
> Next j
> Next i
>
> Any ideas what cause might be? We all have same version of
> Excel....and same version of VB.


--

Dave Peterson
Reply With Quote
  #3 (permalink)  
Old 07-21-2008, 05:12 PM
Ben
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

pagename() is just the tab she wants to activate. and as i said...she
has no problem running the macro. even when we all attempt to run
from network drive...she is able and we can't without the runtime
error.

I can't figure out if something is maybe hardcoded that only reads
correctly from her desktop...or what cause might be. Seems the macro
itself...if it runs for one person, isn't necessarily the issue.


On Jul 21, 9:47*am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> What's in pagename()?
>
> If it's just the name of the workbooks, does it include the extension (like
> .xls)?
>
>
>
>
>
> Ben wrote:
>
> > We have 5 spreadsheet which reside on a network drive. *The
> > spreadsheets are macro driven, and we have issue that only the person
> > who setup the macro's is able to run them. *For everyone else, we
> > receive Runtime Error '9'. *We have tried copying to local drive, and
> > same issue. *Only the creater of the macro's can run them, and this
> > person is leaving the company. *They are unable to figure this out.

>
> > When I receive error and click Debug...it goes to following location
> > in the macro:

>
> > * * For i = 0 To NumOfLeads * * * * * * * * 'adjust TL's sheets
> > * * * * Windows(PageName(i)).Activate * (THIS LINE IS HIGHLIGHTED
> > YELLOW)
> > * * * * For j = 1 To 4
> > * * * * * * Worksheets(Sheets(j).Name).Activate
> > * * * * * * Rows(CopyValue).Copy
> > * * * * * * Rows(RNValue).Select
> > * * * * * * Selection.Insert Shift:=xlDown
> > * * * * Next j
> > * * Next i

>
> > Any ideas what cause might be? *We all have same version of
> > Excel....and same version of VB.

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -


Reply With Quote
  #4 (permalink)  
Old 07-21-2008, 05:49 PM
Dave Peterson
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

I don't think so.


> > > For j = 1 To 4
> > > Worksheets(Sheets(j).Name).Activate


is where she's looping through the worksheets/tabs in the workbook.

pagename() should hold the names of the windows.

Unless you have multiple windows open in a workbook, then this should be an
array of workbook names.

Ben wrote:
>
> pagename() is just the tab she wants to activate. and as i said...she
> has no problem running the macro. even when we all attempt to run
> from network drive...she is able and we can't without the runtime
> error.
>
> I can't figure out if something is maybe hardcoded that only reads
> correctly from her desktop...or what cause might be. Seems the macro
> itself...if it runs for one person, isn't necessarily the issue.
>
> On Jul 21, 9:47 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > What's in pagename()?
> >
> > If it's just the name of the workbooks, does it include the extension (like
> > .xls)?
> >
> >
> >
> >
> >
> > Ben wrote:
> >
> > > We have 5 spreadsheet which reside on a network drive. The
> > > spreadsheets are macro driven, and we have issue that only the person
> > > who setup the macro's is able to run them. For everyone else, we
> > > receive Runtime Error '9'. We have tried copying to local drive, and
> > > same issue. Only the creater of the macro's can run them, and this
> > > person is leaving the company. They are unable to figure this out.

> >
> > > When I receive error and click Debug...it goes to following location
> > > in the macro:

> >
> > > For i = 0 To NumOfLeads 'adjust TL's sheets
> > > Windows(PageName(i)).Activate (THIS LINE IS HIGHLIGHTED
> > > YELLOW)
> > > For j = 1 To 4
> > > Worksheets(Sheets(j).Name).Activate
> > > Rows(CopyValue).Copy
> > > Rows(RNValue).Select
> > > Selection.Insert Shift:=xlDown
> > > Next j
> > > Next i

> >
> > > Any ideas what cause might be? We all have same version of
> > > Excel....and same version of VB.

> >
> > --
> >
> > Dave Peterson- Hide quoted text -
> >
> > - Show quoted text -


--

Dave Peterson
Reply With Quote
  #5 (permalink)  
Old 07-21-2008, 06:22 PM
Ben
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

he reason it's not an array, because by definition there will always
be multiple windows open - there are 5 files open at any time you run
the macro. the macro updates all 5 spreadsheets, plus each of 3 tabs
in each spreadsheet.

She just tried it on someone else's machine...and it worked. So
somehow, somewhere...it's in the way something is setup.



On Jul 21, 10:49*am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> I don't think so.
>
> > > > * * * * For j = 1 To 4
> > > > * * * * * * Worksheets(Sheets(j).Name).Activate

>
> is where she's looping through the worksheets/tabs in the workbook.
>
> pagename() should hold the names of the windows.
>
> Unless you have multiple windows open in a workbook, then this should be an
> array of workbook names.
>
>
>
>
>
> Ben wrote:
>
> > pagename() is just the tab she wants to activate. *and as i said...she
> > has no problem running the macro. *even when we all attempt to run
> > from network drive...she is able and we can't without the runtime
> > error.

>
> > I can't figure out if something is maybe hardcoded that only reads
> > correctly from her desktop...or what cause might be. *Seems the macro
> > itself...if it runs for one person, isn't necessarily the issue.

>
> > On Jul 21, 9:47 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > What's in pagename()?

>
> > > If it's just the name of the workbooks, does it include the extension(like
> > > .xls)?

>
> > > Ben wrote:

>
> > > > We have 5 spreadsheet which reside on a network drive. *The
> > > > spreadsheets are macro driven, and we have issue that only the person
> > > > who setup the macro's is able to run them. *For everyone else, we
> > > > receive Runtime Error '9'. *We have tried copying to local drive,and
> > > > same issue. *Only the creater of the macro's can run them, and this
> > > > person is leaving the company. *They are unable to figure this out.

>
> > > > When I receive error and click Debug...it goes to following location
> > > > in the macro:

>
> > > > * * For i = 0 To NumOfLeads * * * * * * * * 'adjust TL's sheets
> > > > * * * * Windows(PageName(i)).Activate * (THIS LINE IS HIGHLIGHTED
> > > > YELLOW)
> > > > * * * * For j = 1 To 4
> > > > * * * * * * Worksheets(Sheets(j).Name).Activate
> > > > * * * * * * Rows(CopyValue).Copy
> > > > * * * * * * Rows(RNValue).Select
> > > > * * * * * * Selection.Insert Shift:=xlDown
> > > > * * * * Next j
> > > > * * Next i

>
> > > > Any ideas what cause might be? *We all have same version of
> > > > Excel....and same version of VB.

>
> > > --

>
> > > Dave Peterson- Hide quoted text -

>
> > > - Show quoted text -

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -


Reply With Quote
  #6 (permalink)  
Old 07-21-2008, 06:45 PM
Dave Peterson
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

It sure looks like pagename() is an array to me.

And if your workbooks all have 3 worksheets, then you should be getting an error
on these lines:

> > > > > For j = 1 To 4
> > > > > Worksheets(Sheets(j).Name).Activate


The code is trying to look at 4 worksheets.

Again, try to find out what the elements in pagename() are.

You could add code like:

For i = 0 To NumOfLeads
msgbox PageName(i)
next i

to help you debug it.

Ben wrote:
>
> he reason it's not an array, because by definition there will always
> be multiple windows open - there are 5 files open at any time you run
> the macro. the macro updates all 5 spreadsheets, plus each of 3 tabs
> in each spreadsheet.
>
> She just tried it on someone else's machine...and it worked. So
> somehow, somewhere...it's in the way something is setup.
>
> On Jul 21, 10:49 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > I don't think so.
> >
> > > > > For j = 1 To 4
> > > > > Worksheets(Sheets(j).Name).Activate

> >
> > is where she's looping through the worksheets/tabs in the workbook.
> >
> > pagename() should hold the names of the windows.
> >
> > Unless you have multiple windows open in a workbook, then this should be an
> > array of workbook names.
> >
> >
> >
> >
> >
> > Ben wrote:
> >
> > > pagename() is just the tab she wants to activate. and as i said...she
> > > has no problem running the macro. even when we all attempt to run
> > > from network drive...she is able and we can't without the runtime
> > > error.

> >
> > > I can't figure out if something is maybe hardcoded that only reads
> > > correctly from her desktop...or what cause might be. Seems the macro
> > > itself...if it runs for one person, isn't necessarily the issue.

> >
> > > On Jul 21, 9:47 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > > What's in pagename()?

> >
> > > > If it's just the name of the workbooks, does it include the extension (like
> > > > .xls)?

> >
> > > > Ben wrote:

> >
> > > > > We have 5 spreadsheet which reside on a network drive. The
> > > > > spreadsheets are macro driven, and we have issue that only the person
> > > > > who setup the macro's is able to run them. For everyone else, we
> > > > > receive Runtime Error '9'. We have tried copying to local drive, and
> > > > > same issue. Only the creater of the macro's can run them, and this
> > > > > person is leaving the company. They are unable to figure this out.

> >
> > > > > When I receive error and click Debug...it goes to following location
> > > > > in the macro:

> >
> > > > > For i = 0 To NumOfLeads 'adjust TL's sheets
> > > > > Windows(PageName(i)).Activate (THIS LINE IS HIGHLIGHTED
> > > > > YELLOW)
> > > > > For j = 1 To 4
> > > > > Worksheets(Sheets(j).Name).Activate
> > > > > Rows(CopyValue).Copy
> > > > > Rows(RNValue).Select
> > > > > Selection.Insert Shift:=xlDown
> > > > > Next j
> > > > > Next i

> >
> > > > > Any ideas what cause might be? We all have same version of
> > > > > Excel....and same version of VB.

> >
> > > > --

> >
> > > > Dave Peterson- Hide quoted text -

> >
> > > > - Show quoted text -

> >
> > --
> >
> > Dave Peterson- Hide quoted text -
> >
> > - Show quoted text -


--

Dave Peterson
Reply With Quote
  #7 (permalink)  
Old 07-21-2008, 09:04 PM
Ben
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

On Jul 21, 11:45*am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> It sure looks like pagename() is an array to me.
>
> And if your workbooks all have 3 worksheets, then you should be getting an error
> on these lines:
>
> > > > > > * * * * For j = 1 To 4
> > > > > > * * * * * * Worksheets(Sheets(j).Name).Activate

>
> The code is trying to look at 4 worksheets.
>
> Again, try to find out what the elements in pagename() are.
>
> You could add code like:
>
> For i = 0 To NumOfLeads
> * msgbox PageName(i)
> next i
>
> to help you debug it.
>
>
>
>
>
> Ben wrote:
>
> > he reason it's not an array, because by definition there will always
> > be multiple windows open - there are 5 files open at any time you run
> > the macro. *the macro updates all 5 spreadsheets, plus each of 3 tabs
> > in each spreadsheet.

>
> > She just tried it on someone else's machine...and it worked. *So
> > somehow, somewhere...it's in the way something is setup.

>
> > On Jul 21, 10:49 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > I don't think so.

>
> > > > > > * * * * For j = 1 To 4
> > > > > > * * * * * * Worksheets(Sheets(j).Name).Activate

>
> > > is where she's looping through the worksheets/tabs in the workbook.

>
> > > pagename() should hold the names of the windows.

>
> > > Unless you have multiple windows open in a workbook, then this shouldbe an
> > > array of workbook names.

>
> > > Ben wrote:

>
> > > > pagename() is just the tab she wants to activate. *and as i said....she
> > > > has no problem running the macro. *even when we all attempt to run
> > > > from network drive...she is able and we can't without the runtime
> > > > error.

>
> > > > I can't figure out if something is maybe hardcoded that only reads
> > > > correctly from her desktop...or what cause might be. *Seems the macro
> > > > itself...if it runs for one person, isn't necessarily the issue.

>
> > > > On Jul 21, 9:47 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > > > What's in pagename()?

>
> > > > > If it's just the name of the workbooks, does it include the extension (like
> > > > > .xls)?

>
> > > > > Ben wrote:

>
> > > > > > We have 5 spreadsheet which reside on a network drive. *The
> > > > > > spreadsheets are macro driven, and we have issue that only the person
> > > > > > who setup the macro's is able to run them. *For everyone else, we
> > > > > > receive Runtime Error '9'. *We have tried copying to local drive, and
> > > > > > same issue. *Only the creater of the macro's can run them, and this
> > > > > > person is leaving the company. *They are unable to figure this out.

>
> > > > > > When I receive error and click Debug...it goes to following location
> > > > > > in the macro:

>
> > > > > > * * For i = 0 To NumOfLeads * * * * * * * * 'adjust TL's sheets
> > > > > > * * * * Windows(PageName(i)).Activate * (THIS LINE ISHIGHLIGHTED
> > > > > > YELLOW)
> > > > > > * * * * For j = 1 To 4
> > > > > > * * * * * * Worksheets(Sheets(j).Name).Activate
> > > > > > * * * * * * Rows(CopyValue).Copy
> > > > > > * * * * * * Rows(RNValue).Select
> > > > > > * * * * * * Selection.Insert Shift:=xlDown
> > > > > > * * * * Next j
> > > > > > * * Next i

>
> > > > > > Any ideas what cause might be? *We all have same version of
> > > > > > Excel....and same version of VB.

>
> > > > > --

>
> > > > > Dave Peterson- Hide quoted text -

>

Dave...thanks for your help. Looks like a reinstall of Excel is fix
for this issue. No idea why...but seems to be working.

> > > > > - Show quoted text -

>
> > > --

>
> > > Dave Peterson- Hide quoted text -

>
> > > - Show quoted text -

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -


Reply With Quote
  #8 (permalink)  
Old 07-21-2008, 10:37 PM
Dave Peterson
 
Posts: n/a
Re: Runtime Error '9' - Subscript Out of Range

I'm surprised that reinstalling excel would have helped this problem, but glad
you got it working.

Ben wrote:
>

<<snipped>>
> Dave...thanks for your help. Looks like a reinstall of Excel is fix
> for this issue. No idea why...but seems to be working.
>

<<snipped>>
--

Dave Peterson
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



All times are GMT. The time now is 11:32 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108