My macro works with a large (10,000 row) spreadsheet to sort, delete, paste, and resave the data. When I get to the "Sheets.Select" and "Sheets.Move" of the new spreadsheet I am trying to create, the code crashes.
When I step through the code, the macro works. If I put in a "Debug.Assert False" command at the beginning of the code, the command box does come up, and I click "Continue" and the macro runs correctly to the end. Can't debug because the step-through works fine.
'Rename OEM List (2)
Dim QuoteNo As String
Sheets("OEM List (2)").Select
Range("B11").Select
QuoteNo = ActiveCell.Value
ActiveSheet.Name = QuoteNo & " - OEM List"
Range("A1").Select
Dim wsA As Worksheet
Dim strName As String
Dim strFile As String
Dim strPathFile As String
Set wsA = ActiveSheet
'Format all rows
Rows("17:8042").Select
Rows("17:8042").EntireRow.AutoFit
'Export with no copy newly named "Quote *"
'MACRO EITHER CRAHSHES HERE
Sheets(QuoteNo & " - OEM List").Select
'OR HERE
Sheets(QuoteNo & " - OEM List").Move
'OR HERE
The macro is supposed to take the newly created and named spreadsheet, move it to a new workbook, save the workbook with a saved name, close this new workbook, re-save the original workbook and end.
When I step through the code, the macro works. If I put in a "Debug.Assert False" command and run the macro, when the code gets to the .Select or the .Move lines, the command box comes up, I click "Continue" and the macro runs correctly to the end. Can't debug because the step-through works fine.
'Rename OEM List (2)
Dim QuoteNo As String
Sheets("OEM List (2)").Select
Range("B11").Select
QuoteNo = ActiveCell.Value
ActiveSheet.Name = QuoteNo & " - OEM List"
Range("A1").Select
Rows("17:8042").Select
Rows("17:8042").EntireRow.AutoFit
Dim wsA As Worksheet
Dim strName As String
Dim strFile As String
Dim strPathFile As String
Set wsA = ActiveSheet
'Export with no copy newly named "Quote *"
'THE MACRO EITHER CRASHES HERE,
Sheets(QuoteNo & " - OEM List").Select
'OR HERE
Sheets(QuoteNo & " - OEM List").Move
The macro is supposed to take the newly created and named spreadsheet, move it to a new workbook, save the workbook with a saved name, close this new workbook, re-save the original workbook and end.