Hello!
I have recorded a macro that was working fine, but now all of a sudden it is telling me I don't have enough memory. If I end the macro, and run again, it works, but I would prefer it work the first time. I've read some articles stating I need to remove the .Select from the code, but I am new to using VBA and am not quite sure how to do this. Can someone please help? Code is as follows:
I have recorded a macro that was working fine, but now all of a sudden it is telling me I don't have enough memory. If I end the macro, and run again, it works, but I would prefer it work the first time. I've read some articles stating I need to remove the .Select from the code, but I am new to using VBA and am not quite sure how to do this. Can someone please help? Code is as follows:
Code:
Sub CopytoPasteSheet()
'
' CopytoPasteSheet Macro
'
'
Range("C4:D11").Select
Selection.Copy
Sheets("Paste Sheet").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Sheets("Calculator").Select
Range("G4:H10").Select
Selection.Copy
Sheets("Paste Sheet").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Calculator").Select
Range("E13:F16").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Paste Sheet").Select
Range("A19").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Calculator").Select
Range("D18:G22").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Paste Sheet").Select
Range("A25").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A19:B23").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A11:B17").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
Sub ClearCopyPasteSheet()
'
' ClearCopyPasteSheet Macro
'
'
Sheets("Paste Sheet").Select
Cells.Select
Selection.Delete Shift:=xlUp
Sheets("Calculator").Select
End Sub
Sub CopyPasteCombine()
'
' CopyPasteCombine Macro
'
'
Application.Run "'Tangible Benefit Calculator v6.xlsm'!CopytoPasteSheet"
Application.Run "'Tangible Benefit Calculator v6.xlsm'!TestNotePad"
End Sub
Sub ClearCombine()
'
' ClearCombine Macro
'
'
Application.Run "'Tangible Benefit Calculator v6.xlsm'!Clearcells"
Application.Run "'Tangible Benefit Calculator v6.xlsm'!ClearCopyPasteSheet"
End Sub
Last edited by a moderator: