I have a macro that I'm putting together step by step, and I've hit a roadblock. The basics to this point are to open a file from our internal network, copy all of the information, and paste the values into the macro workbook. It then moves a column in that spreadsheet, copies the values of that column, pastes them on a different spreadsheet in the workbook, and removes the duplicates. If I do these steps individually without the macro, everything works fine. Running the macro though, I get the Out of Memory error at the line highlighted below. I've rebooted, closed all open programs except for this workbook, everything I can think of. I'm using Excel 2010 on a Windows 7 laptop with 8GB of RAM installed, 5.5GB available according to the Resource Monitor. Any assistance on how to get around this error would be appreciated. Thanks!
Sub Import1() Application.DisplayAlerts = False Application.EnableEvents = False Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim LR As String Workbooks.Open ("filepath\filename.xlsx") Cells.Copy Windows("Deal Import.xlsm").Activate Sheets("Deal Copy").Activate Cells.PasteSpecial (xlPasteValues) Columns("P:P").Cut Columns("A:A").Insert Shift:=xlToRight Application.CutCopyMode = False Workbooks("filename.xlsx").Close Save = False LR = Range("B10000").End(xlUp).Row Range("A1").Value = "CRM Deal Name" Range("A2").Select ActiveCell.Formula = "=CONCATENATE(RC,"" "",RC,"" Deal #"",RC)" ActiveCell.Copy Range("A2:A" & LR).PasteSpecial (xlPasteFormulas) Cells.Copy Cells.PasteSpecial (xlPasteValues) Application.CutCopyMode = False Range("A1").Select Range("A2:A" & LR).Copy Sheets("Formulas").Activate Range("A4").PasteSpecial (xlPasteValues) Application.CutCopyMode = False LR = Range("A10000").End(xlUp).Row Range("A4:A" & LR).Sort key1:=Range("A4"), order1:=xlAscending Range("A4:A" & LR).RemoveDuplicates Columns = 1, Header = xlNo Application.DisplayAlerts = True Application.EnableEvents = True Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub