randino
01-05-2021, 01:52 PM
Trying to sort a 1 row multiple column range it does seem to work.
So far I have this
Dim vHeader As Variant
Dim rFirstHeading As Range
Set rFirstHeading = Range("B4")
Dim i As Integer
Dim iRow As Integer
iRow = rFirstHeading.Row
Dim iColumn As Integer
iColumn = rFirstHeading.Column
For i = 1 To rColHeaders.Count
Cells(iRow, iColumn).Value = rColHeaders(i)
iColumn = iColumn + 1
Next
' Arange headins in assending order
Dim rHeadings As Range
Set rHeadings = rFirstHeading.Resize(1, rColHeaders.Count)
rHeadings.Sort Key1:=Range("B4"), order1:=xlAscending, Orientation:=xlSortColumns
rHeadings.Sort Orientation:=xlSortColumns
essentially it is Range("B4:F4").sort which give Sort method of range class failed
in the code, the first one runs, but I don't see any results.
So far I have this
Dim vHeader As Variant
Dim rFirstHeading As Range
Set rFirstHeading = Range("B4")
Dim i As Integer
Dim iRow As Integer
iRow = rFirstHeading.Row
Dim iColumn As Integer
iColumn = rFirstHeading.Column
For i = 1 To rColHeaders.Count
Cells(iRow, iColumn).Value = rColHeaders(i)
iColumn = iColumn + 1
Next
' Arange headins in assending order
Dim rHeadings As Range
Set rHeadings = rFirstHeading.Resize(1, rColHeaders.Count)
rHeadings.Sort Key1:=Range("B4"), order1:=xlAscending, Orientation:=xlSortColumns
rHeadings.Sort Orientation:=xlSortColumns
essentially it is Range("B4:F4").sort which give Sort method of range class failed
in the code, the first one runs, but I don't see any results.