Code doesn't work consistently

LC1234

New Member
Joined
Nov 10, 2005
Messages
12
Can someone tell me why this doesn't work the same way everytime? It's supposed to go to a certian range and "turn off" the top & bottom lines. Sometimes it works and sometimes it doesn't. What am I missing? (There is a bunch of code after this that works fine, so I've taken it out.)
Learning on my own, so sorry if this is really simple!

Application.ScreenUpdating = False
Application.DisplayAlerts = False
ActiveSheet.Unprotect Password:="hockey"
Const Spdsht = "B6:V863"
Const MetricNames = "B6:B864"
Const LastLine = "B864:V864"
Const TitleLine = "B4:V4"

Set DC = Range("K1")
Set Index = Range("J1")
Set MetricWanted = Range("P1")
Set Index2 = Range("O1")

Range("E5").Select
Selection.EntireRow.Hidden = False

Range(Spdsht).Select 'remove top & bottom lines
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

How many sheets are there in the workbook? If there is more than one, is it possible that you are on a different sheet from the one that needs the lines removed???


Tony
 

Watch MrExcel Video

Forum statistics

Threads
1,118,010
Messages
5,569,602
Members
412,282
Latest member
bobHenk
Top