Sounds like you want something like the following:
Code:
Option Explicit
Sub prMergeOrders()
Dim strCol As String
Dim strColM As String
Dim lRow As Long
Dim count As Long
Dim i As Long 'Loop Counter
i = 2 'Start Row // Row 1 has headers
strCol = "A" 'Set to the column with the order numbers
strColM = "B" 'Set to the column that you want to merge
lRow = Range(strCol & "65536").End(xlUp).Row
Do While i <= lRow
count = WorksheetFunction.CountIf(Range(strCol & ":" & strCol), Cells(i, strCol).Value)
Range(strColM & i).Resize(count, 1).Merge
i = i + count
Loop
End Sub
Tested on a small sample and it worked nicely for me. Not sure about runtimes for a larger sample.
@Spoo
I think the Application level property you're on about is this:
Code:
Application.ScreenUpdating
I normally do this at the top of each code module. Mainly this stops screen flicker but it also speeds up the macro a small amount.
Code:
With Application
.ScreenUpdating = False
.EnableEvents = False
'Add the line below to make it not calculate formula results (Not sure it's relevant here)
.Calculation = xlCalculationManual
End With
Then do this at the end of the code:
Code:
With Application
.ScreenUpdating = True
.EnableEvents = True
'Add the line below to make it not calculate formula results (Not sure it's relevant here)
.Calculation = xlCalculationAutomatic
End With