MisterEvans
New Member
- Joined
- Feb 27, 2014
- Messages
- 2
Hi,
I have a large set of data and need to run a macro that sorts "column CN", then removes the data where the value in column CN is <50,000. I can do the sorting but not the deleting: please could you help?
The macro so far with the sorting ....
Sub Macrox()
'
' Macrox Macro
'
' Keyboard Shortcut: Ctrl+x
'
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("CN1"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Range("$A$1:$MT$51").AutoFilter Field:=92, Criteria1:="<=50000" _
, Operator:=xlAnd
End Sub
Thanks in advance!!
I have a large set of data and need to run a macro that sorts "column CN", then removes the data where the value in column CN is <50,000. I can do the sorting but not the deleting: please could you help?
The macro so far with the sorting ....
Sub Macrox()
'
' Macrox Macro
'
' Keyboard Shortcut: Ctrl+x
'
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("CN1"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Range("$A$1:$MT$51").AutoFilter Field:=92, Criteria1:="<=50000" _
, Operator:=xlAnd
End Sub
Thanks in advance!!