I have a macro which must run when the excel document is opened. The macro formats the pre-existing excel sheet. In my 'ThisWorkbook' I have the following code
Private Sub Workbook_Open()
Call Rolling25Months
End Sub
and the Rolling25Months has the following code
Sub Rolling25Months()
Application.ScreenUpdating = False
Dim cTitle
Range("E2:M2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
ActiveWindow.LargeScroll ToRight:=1
ActiveWindow.LargeScroll Down:=1
Range("AA43").Select
Selection.Copy
ActiveWindow.LargeScroll Down:=-1
ActiveWindow.LargeScroll ToRight:=-1
Range("E2:M2").Select
ActiveSheet.Paste
etc etc............................
Application.ScreenUpdating = True
End Sub
I get the error on this line:
Range("E2:M2").Select
Any ideas on what I am doing wrong will be greatly appreciated!
Thanks in advance.
Bookmarks