supercharger
New Member
- Joined
- Aug 14, 2017
- Messages
- 13
Hopefully an easy one. This is a code that seems to work most of the time, but will randomly throw up the error in the title. Code is below. It gives the error at the Selection.Insert Shift:=xlToRight line.
I'm in Excel 2016, I can only image that's what is causing this, but I'm not an expert by any means...which is why I'm here.
Any help is greatly appreciated!
I'm in Excel 2016, I can only image that's what is causing this, but I'm not an expert by any means...which is why I'm here.
Any help is greatly appreciated!
Code:
Sub CommsPowerPoint()'
' CommsPowerPoint Macro
'
'
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
Columns("J:J").Select
ActiveSheet.Unprotect "xxx"
Selection.Cut
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
Columns("F:H").Select
Selection.EntireColumn.Hidden = True
Columns("J:M").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 1
Range("A11:I107").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Color = -13303610
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Color = -13303610
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("A10:I10").Select
Selection.AutoFilter
Range("B11").Select
ActiveSheet.Protect "xxx"
End Sub