m_in_spain
Board Regular
- Joined
- Sep 28, 2018
- Messages
- 72
- Office Version
- 365
- Platform
- Windows
I am sure there is a way to shorten this into a loop..but each time I try it doesn't not move down the BY column, just clears the first name. There are many cells that will already be blank with no name, hence the error resume next.
As ever help is appreciated. (sorry there are 100 lines of this!!
As ever help is appreciated. (sorry there are 100 lines of this!!
Code:
Sub deletenames()Application.DisplayAlerts = False
Sheets("calcs").Select
On Error Resume Next
Range("BY3").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY4").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY5").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY6").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY7").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY8").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY9").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY10").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY11").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY12").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY13").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY14").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY15").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY16").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY17").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY18").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY19").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY20").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY21").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY22").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY23").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY24").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY25").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY26").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY27").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY28").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY29").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY30").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY31").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY32").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY33").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY34").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY35").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY36").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY37").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY38").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY39").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY40").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY41").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY42").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY43").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY44").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY45").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY46").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY48").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY48").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY49").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY50").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY51").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY52").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY53").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY54").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY55").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY56").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY57").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY58").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY59").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY60").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY61").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY62").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY63").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY64").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY65").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY66").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY67").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY68").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY69").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY70").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY71").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY72").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY73").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY74").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY75").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY76").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY77").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY78").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY79").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY80").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY81").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY82").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY83").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY84").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY85").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY86").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY87").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY88").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY89").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY90").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY91").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY92").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY93").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY94").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY95").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY96").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY97").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY98").Select
'On Error Resume Next
Selection.Name.Delete
Range("BY99").Select
'On Error Resume Next
Selection.Name.Delete
On Error Resume Next
Range("BY100").Select
Application.DisplayAlerts = False
End Sub