PDA

View Full Version : Solved: Quick Simple Help with Selection Code



LutonBarry
05-31-2013, 03:36 AM
I've noted on here that folk have said that many Select/Selection requests that the rcorder puts into code are unneccesary. Can I ask experienced folk to review the attached code that I recorded to use to clear or delete a number of spreadheets with differing ranges of information leaving just the the top row of the sheets in place.

End Sub
Sub ClearOldData()
'
' ClearOldData Macro
'

'
Application.DisplayAlerts = False
Sheets("Import").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A2").Select
Sheets("All").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Open").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A2").Select
Sheets("Closed").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A2").Select
Sheets("New").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A2").Select
Sheets("Today").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A2").Select
Sheets("Yesterday").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A2").Select
Sheets("Raw Open WIP data").Select
ActiveWindow.SelectedSheets.Delete
Range("A2").Select
Application.DisplayAlerts = True
End Sub