ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Run-time error'9' Subscript out of range. How do I sort? Please (https://www.excelbanter.com/excel-discussion-misc-queries/162018-run-time-error9-subscript-out-range-how-do-i-sort-please.html)

[email protected]

Run-time error'9' Subscript out of range. How do I sort? Please
 
I have a monthly accounts system that when i 'create new period' it moves my
closing stocks forward to become new period opening stocks. Its worked for
years but now I get a Box headed Microsoft Virtual Basic and it says Run-time
error '9' and below it says Subscript out of range.
The Debug box, when pressed, runs for ever and the Help box, when pressed,
give me help in what to me is gobbldygook. Is ther a simple answer please.
Window xp. Excel

Chip Pearson

Run-time error'9' Subscript out of range. How do I sort? Please
 
You get an error 9 when you attempt to access an item that does not exist in
a collection or access an element outside the bounds of an array. For
example,

Debug.Print Worksheets("SheetName").Name

will blow up with an error 9 if "SheetName" doesn't exist. Similarly,

Dim V(1 To 3)
Debug.Print V(4)

will blow up since V has only 3, not 4, elements.

Step through your code by pressing F8 to step from line to line, determine
the line of code that causes the error, and post the code here.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"
om wrote in message
...
I have a monthly accounts system that when i 'create new period' it moves
my
closing stocks forward to become new period opening stocks. Its worked for
years but now I get a Box headed Microsoft Virtual Basic and it says
Run-time
error '9' and below it says Subscript out of range.
The Debug box, when pressed, runs for ever and the Help box, when pressed,
give me help in what to me is gobbldygook. Is ther a simple answer please.
Window xp. Excel




All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com