hello,
I am trying to write a routine to sort a range into descending order but get an error saying that "Order" is not correct syntax. can anyone tell me why pls ? thank you.
kind regards
Kaps
I am trying to write a routine to sort a range into descending order but get an error saying that "Order" is not correct syntax. can anyone tell me why pls ? thank you.
kind regards
Kaps
VBA Code:
Public Sub sort_data(sheets As String)
Dim last_output_row As Integer
Dim output_range As Range
last_output_row = output_wb.sheets(sheets).Cells.SpecialCells(xlCellTypeLastCell).Row
Set output_range = output_wb.sheets(sheets).Range("A2:g" & last_output_row)
output_range.Sort key1:=output_wb.sheets(sheets).Range("d2"), Order:=xlDescending, Header:=xlYes
End Sub