I received a new computer
Old computer had Windows 10, Microsoft Excel 2016, 4 processors, 8 gig memory
New computer has Windows 10, Microsoft Excel 2016, 8 processors, 32 gig memory
The macro copies data (after certain criteria is meet) and places it on another sheet in priority order.
I can use F8 and the data tranfers fine but if I just try to run it it copies the first few cells and ends. No errors given.
On my old computer I can run the macro with no problems.
Lines 31-59 is where the problem comes into play (I made that part of the macro Bold)
Old computer had Windows 10, Microsoft Excel 2016, 4 processors, 8 gig memory
New computer has Windows 10, Microsoft Excel 2016, 8 processors, 32 gig memory
The macro copies data (after certain criteria is meet) and places it on another sheet in priority order.
I can use F8 and the data tranfers fine but if I just try to run it it copies the first few cells and ends. No errors given.
On my old computer I can run the macro with no problems.
Lines 31-59 is where the problem comes into play (I made that part of the macro Bold)
Rich (BB code):
Sub create_summary2()
Dim s_low, s_high As Integer
'Find lowest Priority Number
s_low = WorksheetFunction.Min(Range("B2:B10000"))
'Find highest priority Number
s_high = WorksheetFunction.Max(Range("B2:B10000"))
'64 Bit Declarations: for example ...
Private Declare PtrSafe Sub API_CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, source As Any, ByVal bytes As Long)
#Else
'32 Bit Declarations: for example ...
Public Declare Sub API_CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, source As Any, ByVal bytes As Long)
#End If
Sheets("Summary2").Range("A3:ZZ10000").ClearContents
Sheets("Summary2").Range("A3:ZZ10000").ClearFormats
i = 2
cav_priority = s_low
header_row = 2
summary_col = 1
output_row = 3
Application.Wait (Now + TimeValue("00:00:2"))
Application.StatusBar = "Creating Priority List in Summary2 Worksheet"
Application.ScreenUpdating = False
While Range("A" & i).Cells.Value <> ""
If Range("B" & i).Cells.Value = "Priority" Then
header_row = i
End If
If CStr(Range("B" & i).Cells.Value) = CStr(cav_priority) Then
While Cells(header_row, summary_col).Value <> ""
Sheets("Summary2").Cells(output_row, summary_col).Value = Cells(header_row, summary_col).Value
Cells(header_row, summary_col).Copy
Sheets("Summary2").Cells(output_row, summary_col).PasteSpecial (xlPasteFormats)
Sheets("Summary2").Cells(output_row + 1, summary_col).Value = Cells(i, summary_col).Value
Cells(i, summary_col).Copy
Sheets("Summary2").Cells(output_row + 1, summary_col).PasteSpecial (xlPasteFormats)
summary_col = summary_col + 1
Wend
i = 2
cav_priority = cav_priority + 1
If cav_priority > s_high Then
GoTo line99
End If
output_row = output_row + 2
summary_col = 1
End If
i = i + 1
Wend
line99:
'Get priority 99 separate from others
output_row = output_row + 5
summary_col = 1
i = 2
cav_priority = 99
While Range("A" & i).Cells.Value <> ""
If Range("B" & i).Cells.Value = "Priority" Then
header_row = i
End If
If CStr(Range("B" & i).Cells.Value) = CStr(cav_priority) Then
While Cells(header_row, summary_col).Value <> ""
Sheets("Summary2").Cells(output_row, summary_col).Value = Cells(header_row, summary_col).Value
Cells(header_row, summary_col).Copy
Sheets("Summary2").Cells(output_row, summary_col).PasteSpecial (xlPasteFormats)
Sheets("Summary2").Cells(output_row + 1, summary_col).Value = Cells(i, summary_col).Value
Cells(i, summary_col).Copy
Sheets("Summary2").Cells(output_row + 1, summary_col).PasteSpecial (xlPasteFormats)
summary_col = summary_col + 1
Wend
'i = 2
'cav_priority = cav_priority + 1
output_row = output_row + 2
summary_col = 1
End If
i = i + 1
Wend
Application.ScreenUpdating = True
Application.CutCopyMode = False
Application.Wait (Now + TimeValue("00:00:1"))
Application.StatusBar = ""
Range("A1").Select
Sheets("Summary2").Select
Range("A1").Cells.Value = "Summary sheet generated at: " & Now
End Sub