LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Out of Memory on simple range copy!

I have a large worksheet: 120 columns and 30000 rows
filled up with numeric values (plain values; no formulas,
no formatting of any kind). All I want to do is
programmatically copy this data onto another worksheet
in the same workbook.

It's puzzling and frustrating to see that several
alternative approaches have failed! In all cases, the
result is "Out of Memory" error of Excel, sometimes causing
Excel itself to crash.

Things that I tried (and didn't work):
(assume that I have already created named ranges called myrange
for source and targrange for the target. myrange is on sheet1 and
is filled up, and targrange is on sheet3 and is empty).

1. Sub try1()
Dim myarr As Variant
myarr = Range("myrange").Value
Range("targrange").Value = myarr
End Sub

2. Sub try2()
Dim nCols As Integer, nRows As Integer
Dim rSource As Range, rTarget As Range
Dim i As Integer
Set rSource = Range("myrange")
Set rTarget = Range("targrange")
nCols = rSource.Columns.Count
nRows = rSource.Rows.Count
For i = 1 To nCols
Application.StatusBar = i
rTarget.Columns(i).Value = rSource.Columns(i).Value
Next i
Application.StatusBar = False
End Sub

Tried on many different computers (all with Excel2000, but different
Windows versions). Also with 128k and 256k RAM.

This often works first time you run it; fails on second attempt.
On machine with less memory, first attempt itself fails.

Seems like a memory leak in Excel? Anyway, even if that be so,
I am looking for a workaround.

Any help will be hugely appreciated.

Thanks in advance.
Ajay Sathe
 
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
Line copy - Not just a simple copy paste Ninerref Excel Worksheet Functions 3 September 10th 09 11:44 AM
XL 2007 - Out of Memory - memory leak/bug? PCLIVE Excel Discussion (Misc queries) 0 March 23rd 09 03:31 PM
memory problem of Excel 2003 copy & paste LunaMoon Excel Discussion (Misc queries) 5 August 13th 08 01:51 PM
Copy/Paste - Running out of Memory Cheval New Users to Excel 1 October 12th 06 01:40 PM
simple range problem cantonarv Excel Discussion (Misc queries) 1 November 22nd 05 01:49 PM


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