Hi All,
I am looking for a macro that will delete all specified rows in a worksheet based upon what is in column A. If the row shows "Upload" (which is sorted to the top of the sheet) I want to keep it. If the row shows "No Change" I want to delete it. You can see below when I recorded the macro that It was row 5 I selected the delete all below that. It wont always be row 5, but it will be rows that say "No Change", with them sorted it should always be at the bottom.
Sub UploadSort()
'
' UploadSort Macro
'
'
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("2:2").Select
Application.CutCopyMode = False
Selection.AutoFilter
ActiveWorkbook.Worksheets("Item Upload Template").AutoFilter.Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("Item Upload Template").AutoFilter.Sort.SortFields. _
Add Key:=Range("A2"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Item Upload Template").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Rows("5:5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub
I am looking for a macro that will delete all specified rows in a worksheet based upon what is in column A. If the row shows "Upload" (which is sorted to the top of the sheet) I want to keep it. If the row shows "No Change" I want to delete it. You can see below when I recorded the macro that It was row 5 I selected the delete all below that. It wont always be row 5, but it will be rows that say "No Change", with them sorted it should always be at the bottom.
Sub UploadSort()
'
' UploadSort Macro
'
'
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("2:2").Select
Application.CutCopyMode = False
Selection.AutoFilter
ActiveWorkbook.Worksheets("Item Upload Template").AutoFilter.Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("Item Upload Template").AutoFilter.Sort.SortFields. _
Add Key:=Range("A2"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Item Upload Template").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Rows("5:5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub