'I want to sort order id and product name macros vba
Sub Add2BlankRows()
Dim Rows_All As Integer
Dim curR As Range
Rows_All = Application.Range("C:D").Cells.SpecialCells(xlCellTypeConstants).Count
Range("C2:D" & Rows_All).Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlNo
' Error shown here
Set curR = Range("C2:C" & Rows_All)
For i = curR.Rows.Count To 2 Step -1
If curR.Cells(i, 1).Value <> curR.Cells(i - 1, 1).Value Then
curR.Cells(i, 1).EntireRow.Insert
curR.Cells(i, 1).EntireRow.Insert
End If
Next
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

