Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run-time error '7'

I have gotten a Run-time error '7':
Out of memory

in the follwong code:
Public m2() As Double
Public m1() As Double
Public Sub jk()
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Run-time error '7'

Those are very, very large arrays and they take a lot of memory.
Also, you have not declared the j and k variables and that uses extra memory.
If you can use a Long data type, it will probably work for you.

In addition, they would be much more efficient if you eliminated the need for
the project level scope for the arrays and declared smaller arrays.
You can increase the size of the last dimension of an array at any time
using ReDim Preserve...

Public m2() As Long
Public m1() As Long

Public Sub jk()
Dim j as Long
Dim k as Long
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Soquete"
wrote in message
I have gotten a Run-time error '7':
Out of memory

in the follwong code:
Public m2() As Double
Public m1() As Double
Public Sub jk()
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Run-time error '7'

I still think the OP will run out of memory (unless as you show they change
M1 and M2 to arrays of type Long (4 bytes instead of 8)). The allocation will
still be on the order of half a Gig of memory which is just not feasable...
Using Long arrays you will be down to 250 meg which you will probably get
away with so long as you have a good sense of humor and a lot of patience.
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:

Those are very, very large arrays and they take a lot of memory.
Also, you have not declared the j and k variables and that uses extra memory.
If you can use a Long data type, it will probably work for you.

In addition, they would be much more efficient if you eliminated the need for
the project level scope for the arrays and declared smaller arrays.
You can increase the size of the last dimension of an array at any time
using ReDim Preserve...

Public m2() As Long
Public m1() As Long

Public Sub jk()
Dim j as Long
Dim k as Long
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Soquete"
wrote in message
I have gotten a Run-time error '7':
Out of memory

in the follwong code:
Public m2() As Double
Public m1() As Double
Public Sub jk()
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Run-time error '7'

Jim,
Using Doubles almost stopped my system, but it struggled thru.
Using Longs made a real difference, but Excel still had to think about it..
I had never seen Excel balk when sizing arrays until I ran the op's code..
Jim Cone


"Jim Thomlinson"

wrote in message
I still think the OP will run out of memory (unless as you show they change
M1 and M2 to arrays of type Long (4 bytes instead of 8)). The allocation will
still be on the order of half a Gig of memory which is just not feasable...
Using Long arrays you will be down to 250 meg which you will probably get
away with so long as you have a good sense of humor and a lot of patience.
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:

Those are very, very large arrays and they take a lot of memory.
Also, you have not declared the j and k variables and that uses extra memory.
If you can use a Long data type, it will probably work for you.

In addition, they would be much more efficient if you eliminated the need for
the project level scope for the arrays and declared smaller arrays.
You can increase the size of the last dimension of an array at any time
using ReDim Preserve...

Public m2() As Long
Public m1() As Long

Public Sub jk()
Dim j as Long
Dim k as Long
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Soquete"
wrote in message
I have gotten a Run-time error '7':
Out of memory

in the follwong code:
Public m2() As Double
Public m1() As Double
Public Sub jk()
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Run-time error '7'

The OP's code caused the hamster in my machine to keel over. It made it
through ok on the Long but with Double being twice the size of a long... Boom!
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:

Jim,
Using Doubles almost stopped my system, but it struggled thru.
Using Longs made a real difference, but Excel still had to think about it..
I had never seen Excel balk when sizing arrays until I ran the op's code..
Jim Cone


"Jim Thomlinson"

wrote in message
I still think the OP will run out of memory (unless as you show they change
M1 and M2 to arrays of type Long (4 bytes instead of 8)). The allocation will
still be on the order of half a Gig of memory which is just not feasable...
Using Long arrays you will be down to 250 meg which you will probably get
away with so long as you have a good sense of humor and a lot of patience.
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:

Those are very, very large arrays and they take a lot of memory.
Also, you have not declared the j and k variables and that uses extra memory.
If you can use a Long data type, it will probably work for you.

In addition, they would be much more efficient if you eliminated the need for
the project level scope for the arrays and declared smaller arrays.
You can increase the size of the last dimension of an array at any time
using ReDim Preserve...

Public m2() As Long
Public m1() As Long

Public Sub jk()
Dim j as Long
Dim k as Long
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Soquete"
wrote in message
I have gotten a Run-time error '7':
Out of memory

in the follwong code:
Public m2() As Double
Public m1() As Double
Public Sub jk()
j = 41000
k = 817
ReDim m1(j, k)
ReDim m2(j, k)
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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 10:08 PM.

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

About Us

"It's about Microsoft Excel"