Hi, I am having 'memory' error issue whilst running a file and wonder if anyone can help tweak the memory to improve the file performance. I am using Excel 2010 version. Thanks in advance.
I have a master file with numerous country tabs as well as reporting tabs which pull data from the country tabs. Initially I had a macro which activated an essbase retrieve function and populated each of the country tabs. As the number of rows increased (close to 4800 rows and columns extednign to 'DR' now), running this macro has become next to impossible. So I have now gone for having a separate file which just refreshes the essbase retrieves (and this works fine). I have set up a macro in the master file which then opens this source file and copypastes values from each of the tabs into the corresponding country tab in the master file. But this throws up a 'Excel cannot complete this task with available resources. Choose less data or close other applications’…this despite me having closed all other applications. File size of master file is 13MB and that of the source file (where the retrieve is done) is 18MB. So, effectively when I do the transfer, I have both files open.
I am attaching the code below. I plan to tweak the code to include a 'Do While' to pull all country data. I started initially but trying to pull in two sheets data only and this is crashing...so obvoulsy trying to run this macro for 12 countries is not going to work!!
![]()
Sub CopyPaste () ' ' Copy data from Source worksheet to master workbook ' Dim wb1 As Workbook FileToOpen = Application.GetOpenFilename _ (Title:="Please choose a Report to Copy from", _ FileFilter:="Excel Files,*.xls*") If FileToOpen = False Then MsgBox "No File Specified.", vbExclamation, "ERROR" Exit Sub Else Set wb1 = Workbooks.Open(Filename:=FileToOpen) wb1.Sheets("Revenue").UsedRange.Copy ThisWorkbook.Sheets("Revenue").Range("A1").PasteSpecial xlPasteValuesAndNumberFormats wb1.Sheets("France").UsedRange.Copy ThisWorkbook.Sheets("France").Range("A1").PasteSpecial xlPasteValuesAndNumberFormats End If wb1.Close SaveChanges:=False End Sub
Bookmarks