I found this code that is supposed to be for sorting rows of data keeping 2 rows together.
if i run the code from a button or from tools /macro I get an error message "named arguement not found" on the line DataOption1:=xlSortNormal
can anyone tell me if this code will work for them and how to make it work
Thanks
John
if i run the code from a button or from tools /macro I get an error message "named arguement not found" on the line DataOption1:=xlSortNormal
can anyone tell me if this code will work for them and how to make it work
Thanks
John
Code:
Sub Macro1()
Dim myRow As Long
Columns("A:B").Insert
Range("A1").Value = "Sort1"
Range("B1").Value = "Sort2"
Range("A2").FormulaR1C1 = "=RC[2]"
Range("A3").FormulaR1C1 = "=R[-1]C[2]"
Range("A2:A3").Copy
myRow = Cells(Rows.Count, 3).End(xlUp).Row
If myRow Mod 2 <> 1 Then myRow = myRow + 1
Range("A2:B" & myRow).Select
ActiveSheet.Paste
With Columns("A:B")
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Range("A3").CurrentRegion.Sort Key1:=Range("A2"), Order1:=xlAscending, _
Key2:=Range("B2"), Order2:=xlAscending, Header:=xlYes, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Columns("A:B").Delete
End Sub