VB Editor says "Out of Memory"

anilsharaf

New Member
Joined
Apr 8, 2014
Messages
43
Office Version
  1. 2007
Platform
  1. Windows
When I run macro VB Editor says "Out of Memory". But when I restarted the file it worked. I Use Window 7, And MSOffice 2007. How to Fix this. Thanks in Advance.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
anilsharaf,

In order to assist you it would help us if you posted all of your macro code using code tags.


When posting VBA code, please use Code Tags - like this:

[code=rich]

'Paste your code here.

[/code]
 
Upvote 0
The File is here
https://app.box.com/s/y017sb7ob122891uro880mcf2696a44p

Code is here
Code:
Option Explicit
Sub BiodataWritting_27_ColmIn_3Rows()
' Active sheet is "cc"
'there should not be Extra Numbering in Colm A
Dim LinerArr() As Variant 'don't declare elements (or array size)
    Dim SplitedArray() As Variant
Dim hrbb, NoR, Norow, Ocolm, TotalElements, NeededRow, x, y, z, _
i, c, r, NewR, NewC, NeededColm, turn, hrcc As Integer
 
 Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Active sheet should be 'cc'" & vbCr & _
            "There should not be Extra Numbering in Colm A in Sheet 'bb'" & vbCr & _
            "because it will decide No of Students" & vbCr & _
            "Change value of Norow or No of Rows in the Programme" & vbCr & _
            "If U don't want to continue 'Press Cancel'"
' Define message.
Style = vbOKCancel + vbCritical    ' Define buttons.
Title = "Check The Followings"    ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbCancel Then    ' User chose Yes.
    Exit Sub
End If
 
 hrbb = 2 'count of header row when array reads sht"bb" cells
 With Worksheets("bb")
      'below is Number of Students in Sheet 'bb'
      'NoR = Number of Records
      'so there should not be Extra Numbering in Colm A
  NoR = .Range("A65536").End(xlUp).Row - hrbb
 End With
 
   hrbb = 2 'count of header row when array reads sht"bb" cells
      hrcc = 3 'count of header row in sht"cc" cells
   'NoR = 136 'Count of Students or Records ( here 116 students)
   Ocolm = 27 'count of colms in Basic table.
   TotalElements = NoR * Ocolm
   Norow = 3 ' Count of Rows that will need for each Record
             'when writting in sheet"cc".
   NeededRow = NoR * Norow 'there are 27 element in one row or Record
        'so it will need 3 rows for each record.whn wrting at sht.
        '136*3 = 408 row for all records working at "step 3".
 NeededColm = Ocolm / Norow ' Count of Colm that will need
        'for each Record when writting in sheet"cc".


     ReDim Preserve SplitedArray(1 To NeededRow, 1 To NeededColm)
     ReDim Preserve LinerArr(TotalElements)
    'Below: When Hindi "sh" or "'"(as in Shubhi Sharma) is written
    'to Array it Trims "sh". The Following condition prevents it.
    'Array also changes Date Format when reading at one shot.
    'but not when it is read element by elememt instead
    'of reading at one shot.like-> array = range (A1:AA138)
    
        '1.Now read the records element by element to make a liner Array
With Worksheets("bb")
    i = 0 'this will hold elements of Array
     For r = 1 To NoR 'Total Records,136 here
         For c = 1 To Ocolm 'Records are in 27 colms.whn arry reads.
             i = i + 1 'arry elemtn 1st
                
                If .Cells(r + hrbb, c).Font.Name = "Kruti Dev 010" _
                And Left(.Cells(r + hrbb, c), 1) = "'" Then
                
                LinerArr(i) = "'" & .Cells(r + hrbb, c)
                Else: LinerArr(i) = .Cells(r + hrbb, c): End If
                
        Next c
    Next r
End With
    
    x = LinerArr(53) 'Test
    y = LBound(LinerArr) 'Test
    z = UBound(LinerArr) 'Test
     'Cells(3, 7) = x 'A Test
    
          '2.Now split the Array in NeededRow and NeededColm
  
    i = 1
    For turn = 1 To NeededRow Step 3
     For NewC = 1 To NeededColm
      For NewR = turn To turn + 2
         SplitedArray(NewR, NewC) = _
          LinerArr(i): i = i + 1
      Next NewR
      
    Next NewC
   Next turn
  
   '3.Now Write the splited Records in Sheet cc


     Worksheets("cc").Range(Cells(4, 1), Cells(NeededRow + hrcc, NeededColm)).Value = SplitedArray
    
End Sub
Sub BiodataWritting_33_ColmIn_3Rows()
'Active sheet should be "cc"
'there should not be Extra Numbering in Colm A
'***** this shows that this may be changed according to needs.
Dim LinerArr() As Variant 'don't declare elements (or array size)
    Dim SplitedArray() As Variant
Dim hrbb, NoR, Norow, Ocolm, TotalElements, NeededRow, NeededColm, x, y, z, _
i, c, r, NewR, NewC, turn, hrcc As Integer
 
 Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Active sheet should be 'cc'" & vbCr & _
            "There should not be Extra Numbering in Colm A in Sheet 'bb'" & vbCr & _
            "because it will decide No of Students" & vbCr & _
            "Change value of Norow or No of Rows in the Programme" & vbCr & _
            "If U don't want to continue 'Press Cancel'"
' Define message.
Style = vbOKCancel + vbCritical    ' Define buttons.
Title = "Check The Followings"    ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbCancel Then    ' User chose Yes.
    Exit Sub
End If




  hrbb = 2 'count of header row when array reads sht"bb" cells
    hrcc = 3 'count of header row in sht"cc" cells


 With Worksheets("bb")
      'below is Number of Students in Sheet 'bb'
      'NoR = Number of Records( here 116 students)
  NoR = .Range("A65536").End(xlUp).Row - hrbb
 End With
 
   'hrbb = 2 'count of header row when array reads sht"bb" cells
   'NoR = 136 'Count of Students or Records
   Ocolm = 33 'count of colms in Basic table.*****
   Norow = 3 ' Count of Rows that will need for each Record*****
             'when writting in sheet"cc".
   TotalElements = NoR * Ocolm
   NeededRow = NoR * Norow 'there are 33 element in one row or Record
        'so it will need 3 rows for each record.whn wrting at sht.
        '136*3 = 408 row for all records working at "step 3".
   NeededColm = Ocolm / Norow ' Count of Colm that will need
        'for each Record when writting in sheet"cc".
             


     ReDim Preserve SplitedArray(1 To NeededRow, 1 To NeededColm)
     ReDim Preserve LinerArr(TotalElements)
    'Below: When Hindi "sh" or "'"(as in Shubhi Sharma) is written
    'to Array it Trims "sh". The Following condition prevents it.
    'Array also changes Date Format when reading at one shot.
    'but not when it is read element by elememt instead
    'of reading at one shot.like-> array = range (A1:AA138)
    
        '1.Now read the records element by element to make a liner Array
With Worksheets("bb")
    i = 0 'this will hold elements of Array
     For r = 1 To NoR 'Total Records,136 here
         For c = 1 To Ocolm 'Records are in 33 colms.whn arry reads.
             i = i + 1 'arry elemtn 1st
                
                If .Cells(r + hrbb, c).Font.Name = "Kruti Dev 010" _
                And Left(.Cells(r + hrbb, c), 1) = "'" Then
                
                LinerArr(i) = "'" & .Cells(r + hrbb, c)
                Else: LinerArr(i) = .Cells(r + hrbb, c): End If
                
        Next c
    Next r
End With
    'x = LinerArr(28) 'Test
    ': y = LBound(LinerArr):z = UBound(LinerArr):'Cells(3, 7) = x 'A Test
    
             '2.Now split the Array in NeededRow and NeededColm
    i = 1
    For turn = 1 To NeededRow Step 3
     For NewC = 1 To NeededColm
      For NewR = turn To turn + 2
         SplitedArray(NewR, NewC) = _
          LinerArr(i): i = i + 1
      Next NewR
    Next NewC
   Next turn
   
      '3.Now Write the splited Records in Sheet cc
     Worksheets("cc").Range(Cells(4, 1), Cells(NeededRow + hrcc, NeededColm)).Value = SplitedArray
    
End Sub
Sub BiodataWritting_36_ColmIn_3Rows()
'Active sheet should be "cc"
'there should not be Extra Numbering in Colm A
'***** this shows that this may be changed according to needs.
Dim LinerArr() As Variant 'don't declare elements (or array size)
    Dim SplitedArray() As Variant
Dim hrbb, NoR, Norow, Ocolm, TotalElements, NeededRow, NeededColm, x, y, z, _
i, c, r, NewR, NewC, turn, hrcc As Integer
 
 Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Active sheet should be 'cc'" & vbCr & _
            "There should not be Extra Numbering in Colm A in Sheet 'bb'" & vbCr & _
            "because it will decide No of Students" & vbCr & _
            "Change value of Norow or No of Rows if it is not 3rows" & vbCr & _
            "If U don't want to continue 'Press Cancel'"
' Define message.
Style = vbOKCancel + vbCritical    ' Define buttons.
Title = "Check The Followings"    ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbCancel Then    ' User chose Yes.
    Exit Sub
End If




  hrbb = 2 'count of header row when array reads sht"bb" cells
  hrcc = 3 'count of header row in sht"cc" cells
 With Worksheets("bb")
      'below is Number of Students in Sheet 'bb'
      'NoR = Number of Records ( here 116 students)
  NoR = .Range("A65536").End(xlUp).Row - hrbb
            'NoR = Last used row in bb (118)  - count of header row in bb (2) =116 students
 End With
 
   'hrbb = 2 'count of header row when array reads sht"bb" cells
   'NoR = 136 'Count of Students or Records
   Ocolm = 36 'count of colms in Basic table.(bb) *****
   Norow = 3 ' Count of Rows that will need for each Record in cc *****
             'when writting in sheet"cc".
   TotalElements = NoR * Ocolm
   NeededRow = NoR * Norow 'there are 33 element in one row or Record
        'so it will need 3 rows for each record.whn wrting at sht.
        '136*3 = 408 row for all records working at "step 3".
   NeededColm = Ocolm / Norow ' Count of Colm that will need
        'for each Record when writting in sheet"cc".
             


     ReDim Preserve SplitedArray(1 To NeededRow, 1 To NeededColm)
     ReDim Preserve LinerArr(TotalElements)
    'Below: When Hindi "sh" or "'"(as in Shubhi Sharma) is written
    'to Array it Trims "sh". The Following condition prevents it.
    'Array also changes Date Format when reading at one shot.
    'but not when it is read element by elememt instead
    'of reading at one shot.like-> array = range (A1:AA138)
    
    '1.Now read the records element by element to make a liner Array
With Worksheets("bb")
    i = 0 'this will hold elements of Array
     For r = 1 To NoR 'Total Records,136 here
         For c = 1 To Ocolm 'Records are in 33 colms.whn arry reads.
             i = i + 1 'arry elemtn 1st
                
                If .Cells(r + hrbb, c).Font.Name = "Kruti Dev 010" _
                And Left(.Cells(r + hrbb, c), 1) = "'" Then
                
                LinerArr(i) = "'" & .Cells(r + hrbb, c)
                Else: LinerArr(i) = .Cells(r + hrbb, c): End If
                
        Next c
    Next r
End With
    'x = LinerArr(28) 'Test
    ': y = LBound(LinerArr):z = UBound(LinerArr):'Cells(3, 7) = x 'A Test
    
             '2.Now split the Array in NeededRow and NeededColm
    i = 1
    For turn = 1 To NeededRow Step 3
     For NewC = 1 To NeededColm
      For NewR = turn To turn + 2
         SplitedArray(NewR, NewC) = _
          LinerArr(i): i = i + 1
      Next NewR
    Next NewC
   Next turn
   
   'Now Write the splited Records in Sheet cc
     Worksheets("cc").Range(Cells(4, 1), Cells(NeededRow + hrcc, NeededColm)).Value = SplitedArray
    
End Sub
 
Upvote 0
anilsharaf,

Thanks for the workbook.

I have had problems in the past when attempting to download an Excel file with macros, with the xlsm file extension.

Please remove all macros, and, then rename the workbook using the xlsx file extension, and, then repost again.
 
Upvote 0
Hi Hiker,
Thanks for giving Ur valuable time
the File is here in .xlsx form
https://app.box.com/s/ibqs5628yzma6gqnpciejqw0k584fhir

anilsharaf,

Your workbook contains a lot of personal information?????

When I attempted to save the workbook, I received the following message:

Do you want to save the changes you made to 'student biodata 10th To Mrxl.com.xlsx'?????


I have never see a workbook name per the above.


Maybe someone else on MrExcel will be able to assist you.
 
Upvote 0
It all is only the name of the file. I have named the file "student biodata 10th To Mrxl.com". So it is only asking U to save the file or not.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top